Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generalize cyclical subview detection #6125

Open
sharadsw opened this issue Jan 21, 2025 · 0 comments
Open

Generalize cyclical subview detection #6125

sharadsw opened this issue Jan 21, 2025 · 0 comments
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system

Comments

@sharadsw
Copy link
Contributor

Related to #6067, originates from #5253

If you open a subview in a different dialog which tries to render a field that has already been rendered in the parent form, the field is hidden.

From @emenslin:
for example if you were to go to the CO form, open cataloger agent, add new group, then you can see the new agent form doesn't show the group

01-21-2025_09.27.mp4

Context from @melton-jason:
Previously, if there was a cyclical referencing of Views (e.g., both sides of the relationship are rendered CollectionObject -> accession, Accession -> collectionObjects), then this would cause an infinite loop of rendering loops (See #5253 (review)).
Now behind-the-scenes subviews keep track of which relationships have already been rendered in a specific SubView hierarchy. If a relationship (like RepositoryAgreement -> accessions) would be rendered as a SubView but it already is being rendered, then Specify will not render that relationship.

#6114 adds a naive hotfix to avoid this problem in COGs, where it is most commonly seen. The problem doesn't seem to occur often enough for now but eventually we should try to generalize the code for cyclical detection.

<SubViewContext.Provider value={contextValue}>
{!RECURSIVE_RENDERING_EXCEPTIONS.has(parentResource.specifyTable) &&
parentContext
.map(({ relationship }) => relationship)
.includes(relationship) || collection === false ? undefined : (
<>

@sharadsw sharadsw added 1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system labels Jan 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
1 - Bug Incorrect behavior of the product 2 - Forms Issues that are related to the form system
Projects
None yet
Development

No branches or pull requests

1 participant