Skip to content

fix: publication site selection and action label flicker - #31

Merged
BatLeDev merged 2 commits into
masterfrom
fix-publication-site-item-key
Jul 16, 2026
Merged

fix: publication site selection and action label flicker#31
BatLeDev merged 2 commits into
masterfrom
fix-publication-site-item-key

Conversation

@BatLeDev

Copy link
Copy Markdown
Member

Two fixes to step 1 of the new publication form.

  • Publication site select — the field defined itemValue but no itemKey, so the resolved object became the key. vjsf re-derives the key from that resolved value (valueComparator, prepareSelectedItem), and on that pass context.publicationSites[item] returns undefined: every item collapsed to the key "undefined", the comparator reported them all equal to the current selection, and only the first option was ever selectable — the title collapsed to "undefined (undefined)" the same way. Both expressions now accept either the raw "<type>:<id>" string or the resolved object.
  • Action labels — the plugin overrides actionLabels through its own i18n, merged once the plugin request resolves, after the catalog one. The schema computed reads t(), so that merge gave it a new identity, and vjsf rebuilds its whole state tree whenever the schema changes identity: the form appeared with the generic labels, then rebuilt with the plugin's. It now waits for the merge and is built once, already carrying the final labels. defaultAction also stopped being written from inside a computed.

Why: both reported on staging — only the first publication site was clickable, and the labels flickered between the generic and the plugin-overridden ones.

Heads-up:

  • This predates the vuetify 4 migration: valueComparator and prepareSelectItem are identical in vjsf 3.26 / json-layout core 2.4, and the migration touched neither the page nor the schema.
  • itemKey uses the site's url — the only field present both in the raw item and in the resolved object. Two publication sites sharing a URL would collide.
  • Step 1 now waits for the plugin request before rendering: one extra round-trip of empty step instead of a flicker.

BatLeDev added 2 commits July 16, 2026 11:17
dataset.publicationSites is a list of "<type>:<id>" strings that itemValue
resolves into an object through the context. With no itemKey, json-layout
fell back to using that resolved object as the key, and vjsf re-derives the
key from the resolved value (valueComparator, prepareSelectedItem) rather
than from the raw item. On that second pass the item is already an object,
so context.publicationSites[item] returned undefined and every item ended up
with the key "undefined" — the comparator then reported every item as equal
to the current selection, leaving only the first one selectable. The title
collapsed to "undefined (undefined)" the same way.

Give the node an explicit itemKey and make both expressions accept either
the raw string or the resolved object, so the key survives the round-trip.

This predates the vuetify 4 migration: valueComparator and prepareSelectItem
are identical in vjsf 3.26 / json-layout core 2.4.
The plugin overrides actionLabels through its own i18n messages, merged in a
watcher once the plugin request resolves — after the catalog one. Since the
schema computed reads t(), that merge gave it a new identity, and vjsf rebuilds
its whole state tree whenever the schema changes identity: the form appeared
with the generic labels, then tore itself down and came back with the plugin's.
Wait for the merge before building, so the form is built once, already carrying
the final labels.

Also stop writing defaultAction from inside the schema computed: side effects in
a computed are a reactivity hazard. availableActions and defaultAction become
computeds of their own, which reads better and drops the hidden ordering between
them and the schema.
@github-actions github-actions Bot added the fix label Jul 16, 2026
@BatLeDev
BatLeDev merged commit 4b8cb1f into master Jul 16, 2026
4 checks passed
@BatLeDev
BatLeDev deleted the fix-publication-site-item-key branch July 16, 2026 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant