-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
SWC-6486 - Fix case where cached annotations would not load into the …
…schematized annotation editor State management errors in useGetJson and SchemaDrivenAnnotationEditor led to a case where 1. The cache was 'hot', but since `useGetJson`'s return `annotations` was stored in state instead of derived from state, it was undefined when the data was loaded; i.e. there was one instance where `annotations` was `undefined` but `isLoading` was `false` 2. SchemaDrivenAnnotationEditor's `formData` was initialized with the undefined `annotations` value 3. RJSF takes the undefined `formData` value and transforms it to an empty object and somehow components become uncontrolled and get out of sync-this seems to be a bug in RJSF. We can fix this by 1. Derive the value of `annotations` from the Entity JSON data, so it will never be undefined when `isLoading` is false 2. Initialize `formData` using `annotations`, so `undefined` will not passed into the `Form` component when the cache is hot 3. Prevent rendering the `Form` component when `formData` is undefined
- Loading branch information
Showing
5 changed files
with
256 additions
and
180 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Oops, something went wrong.