fix(ui): keep the page elements editor context in sync with the pages list - #114
Merged
Conversation
… list The vjsf options were built once on setup, so their context froze the pages prop as it was at that moment. When the elements editor mounted before the pages fetch of the parent resolved, the link configuration of every element kept an empty pages list and no link could target a page.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The VJSF options of the page elements editor were built once on setup, so their
contextfroze the pages list as it was at that moment. When the editor mounted before the parent's pages fetch resolved, the "Page" selector of every link stayed empty ("Aucune donnée disponible") and no link could target a page — navigation button and menu elements included.vjsfOptionsbecomes acomputed, so the context follows thepagesprop instead of a setup-time snapshot@ts-ignoreonmessagesbecomes a typed cast, since the comment no longer applies from inside the getterWhy: on a page draft, configuring a link towards a page was failing at random — the editor mounting before
GET /api/pagesresolved was enough to lose the whole list for the rest of the session.Heads-up:
useVjsfhandles that (it compares options before rebuilding), but the page editor is sensitive to state-tree rebuilds — that is the part worth reviewing.GET /api/pagesby 6 s, and verified before/after — empty selector, then the full list and a link persisted with aPATCH200.