fix(rich-text-versioning): pin react-query v4 to fix editor load crash []#11048
Open
david-shibley-contentful wants to merge 1 commit into
Open
fix(rich-text-versioning): pin react-query v4 to fix editor load crash []#11048david-shibley-contentful wants to merge 1 commit into
david-shibley-contentful wants to merge 1 commit into
Conversation
Vite was hoisting @tanstack/react-query v5 from field-editor-shared, which left FetchingWrappedInlineEntryCard treating in-flight fetches as success and reading entry.sys before data loaded. Pin v4 at the app level so embedded reference cards use loading status correctly. Also harden the version comparison dialog against missing link targets and fix stale state when fetching content types for embedded entries. Co-authored-by: Cursor <cursoragent@cursor.com>
Joaquin (joaquincasal)
approved these changes
Jul 2, 2026
| if (contentTypeIds.length > 0) { | ||
| const fetchedContentTypes = await sdk.cma.contentType.getMany({ | ||
| query: { | ||
| 'sys.id[in]': contentTypeIds.join(','), |
Collaborator
There was a problem hiding this comment.
Just in case: this is changing from an array to a comma-separated string, but I'd expect either work
Contributor
Author
There was a problem hiding this comment.
Good call. Either should work with the CMA client. I used .join(',') here to match getEntries / getAssets in this file, not because the array form was failing.
The meaningful change in this block is using the freshly fetched entries (instead of stale state), deduping IDs, and guarding missing contentType refs. Happy to switch back to passing the array if you prefer consistency with the old line rather than with the other queries in Dialog.tsx.
Collaborator
There was a problem hiding this comment.
No need! As long as the CMA accepts both, it's good
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.
Summary
@tanstack/react-query@4.44.0as a direct dependency so Vite bundles v4 instead of hoisting v5 from@contentful/field-editor-sharedCannot read properties of undefined (reading 'sys')when loading the rich text editor on fields with embedded entry/asset referencesRoot cause
With react-query v5 hoisted,
FetchingWrappedInlineEntryCardin@contentful/field-editor-rich-text@6.3.9does not treat'pending'as a loading state. The success branch renders before entity data is available and accessesentry.sys.Test plan
npm run buildpasses inapps/rich-text-versioningnpm testpasses (32 tests)Made with Cursor