{{ message }}
fix(review-workflows): pass locale params to useDocument in StageSelect and AssigneeSelect#26104
Open
fix(review-workflows): pass locale params to useDocument in StageSelect and AssigneeSelect#26104
Conversation
…ct and AssigneeSelect StageSelect and AssigneeSelect were calling unstable_useDocument without the query params (which carry the active locale). This caused both components to always fetch and display data from the default locale, regardless of which locale the editor had open. As a result, when viewing a non-default locale entry, the displayed review stage and assignee reflected the default locale's values. After updating the stage or assignee for a non-default locale, the cache invalidation triggered a refetch that still omitted the locale param, so the panel appeared unchanged even though the backend had been updated correctly. Passing params to unstable_useDocument aligns the document fetch with the locale already used by the mutations (useUpdateStageMutation, useUpdateAssigneeMutation) and the stages query (useGetStagesQuery), ensuring the panel reads from and reflects the correct locale.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
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.

What does it do?
StageSelectandAssigneeSelectwere callingunstable_useDocumentwithout the queryparams(which carry the active locale). Because RTK Query uses the full args object as its cache key, a call withoutparamsis a separate cache entry from a call withparams: { locale: 'fr' }— it makes its own request and gets the default locale's document back.This change passes params to unstable_useDocument in both components:
unstable_useDocument({ collectionType, model, documentId: id, params }Why is it needed?
When editing a non-default locale entry with review workflows enabled, the stage and assignee panel reads from a document fetch that has no locale — so it always reflects the default locale's values. After updating the stage or assignee (both mutations already pass
paramscorrectly), the cache invalidation triggers a refetch that still omits the locale, so the panel appears unchanged even though the backend was updated correctly.This aligns
unstable_useDocumentwith the locale already used byuseUpdateStageMutation,useUpdateAssigneeMutation, anduseGetStagesQueryin those same components.How to test it?
Related issue(s)/PR(s)
None on file. Happy to open an issue if preferred.
Related to Internal Ticket ID: 7885