fix: draw the settings on the plugin card, not a click deeper
The page was registered into `plugins.row.config`, keyed
`<package>#<row id>`. That seat puts a page behind the ROW's title button on the
bundle's card — the right home for one row of a bundle that declares several,
and the reasoning the previous commit wrote down. What it missed is that this
bundle declares exactly one row, so its settings became reachable only by
opening the card and noticing that the row title had turned into a button.
Reported from a real install as "it shows the plugin just no settings", while
the sibling plugin's settings were visible: that one registers into
`plugins.bundle.config`.
`plugins.bundle.config` is the same document, dispatched on the card itself:
`PackageDetail` gates a section on `ledger.bundles.has(pkg.name)` and renders
`renderSlot("plugins.bundle.config", { view: "page" }, { entryKey: pkg.name })`
between the description and the rows. So the key becomes the bundle's package
name, and the form draws where someone opening "dsh-recall" is already looking.
The section gets no `form` prop at this seat, unlike the row page — which is
fine, because the card reads its own form from `configForms` rather than
depending on the one handed in.
Verified by serving the bundle from a profile that links this checkout and
reading the artifact back: the served `client.js` carries
`plugins.bundle.config` at the registration and names the retired seat only in
prose. The tests pin the new key and now fail if either the seat or the key
drifts.
This commit is contained in:
1 parent
1f42d2a821
commit
233215e6c9
3 files changed
+55
-36
No files matched your search
+23
-16
@@ -12,10 +12,11 @@
|
||||
* binding `settingsScope` and registering into a `settings.plugin.item` slot.
|
||||
* Neither exists in 0.1.7. The generated settings document is keyed by the
|
||||
* plugin's own profile entry id, and a plugin that wants a page renders it as a
|
||||
* contribution to the Plugins panel: `plugins.row.config`, keyed
|
||||
* `<bundle package>#<row id>`. That key is what puts a **configure** control on
|
||||
* the plugin's row — without a contribution there is no control and no page,
|
||||
* however complete the schema is.
|
||||
* contribution to the Plugins panel — `plugins.bundle.config`, keyed by the
|
||||
* bundle's package name, which the page draws as a section on the plugin's own
|
||||
* card. Without a contribution there is no section, however complete the schema
|
||||
* is; the sibling seat `plugins.row.config` would instead put it one click
|
||||
* deeper, on a single row's page.
|
||||
*
|
||||
* **The page is the framework's form, not a form of our own.** The card used to
|
||||
* reproduce `PluginCard`'s chrome by hand — the `<li>` root, the disclosure
|
||||
@@ -70,13 +71,17 @@ window.__ModuleLoader__.load({
|
||||
/**
|
||||
* The seat this plugin's configuration page renders in.
|
||||
*
|
||||
* Keyed `<bundle package name>#<row id>`, both as the profile's patch
|
||||
* declares them. For this bundle the two coincide, which is a coincidence
|
||||
* and not a rule — the constants are kept separate so that stays visible.
|
||||
* `plugins.bundle.config`, keyed by the BUNDLE's package name: the Plugins
|
||||
* page draws that contribution as a section on the plugin's own card,
|
||||
* between its description and its rows. That is where someone opening
|
||||
* "dsh-recall" expects its settings — the alternative seat,
|
||||
* `plugins.row.config` (keyed `<package>#<row id>`), draws them on a page
|
||||
* one click deeper, behind the row's title button, which is the right home
|
||||
* for one row of a bundle that declares several. This bundle declares one
|
||||
* row, so the card is the honest place.
|
||||
*/
|
||||
const BUNDLE_PACKAGE = 'dsh-recall'
|
||||
const BUNDLE_ROW = 'dsh-recall'
|
||||
const ROW_CONFIG_KEY = `${BUNDLE_PACKAGE}#${BUNDLE_ROW}`
|
||||
const BUNDLE_CONFIG_KEY = BUNDLE_PACKAGE
|
||||
|
||||
const TITLE = 'Recall'
|
||||
const DESCRIPTION =
|
||||
@@ -486,10 +491,12 @@ window.__ModuleLoader__.load({
|
||||
/**
|
||||
* The plugin's configuration page.
|
||||
*
|
||||
* The Plugins page asks a configuration entry twice: once for a one-liner to
|
||||
* stand in for a missing description (`summary`), and once for the body of
|
||||
* the plugin's own page (`page`). Only the second draws a save control —
|
||||
* and only one save writes, because the form discards its drafts on unmount.
|
||||
* The seat asks for `page`, the form with its save control; the `summary`
|
||||
* branch answers the other shape a configuration entry can be asked for —
|
||||
* the one-liner standing in for a missing description — because a component
|
||||
* registered under a seat that only ever asks for `page` is also the natural
|
||||
* thing to reuse where that shape arrives. Only a save writes, and the form
|
||||
* discards its drafts on unmount.
|
||||
*/
|
||||
function RecallSettingsCard(props) {
|
||||
if (props.view === 'summary') return DESCRIPTION
|
||||
@@ -705,11 +712,11 @@ window.__ModuleLoader__.load({
|
||||
scoped.effect(
|
||||
() =>
|
||||
scoped.configForms.whileServed([SETTINGS_ENTRY], () =>
|
||||
scoped.slots.inject('plugins.row.config', () =>
|
||||
scoped.slots.inject('plugins.bundle.config', () =>
|
||||
scoped.slots.register(
|
||||
{
|
||||
name: 'plugins.row.config',
|
||||
key: ROW_CONFIG_KEY,
|
||||
name: 'plugins.bundle.config',
|
||||
key: BUNDLE_CONFIG_KEY,
|
||||
inject: () => card.inject(),
|
||||
},
|
||||
RecallSettingsCard,
|
||||
|
||||
Reference in new issue
Block a user