Skip to content

Commit

Permalink
JNG-6072 dialog from row lifecycle (#499)
Browse files Browse the repository at this point in the history
  • Loading branch information
noherczeg authored Dec 17, 2024
1 parent ec9085d commit dfc345a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -665,7 +665,12 @@ export default function ViewGalaxyStarsRelationViewPage(props: ViewGalaxyStarsRe
if (rootPageId && dataPath && isDraft) {
subscriptionRef.current = subscribe(`${rootPageId}:refreshed`, async (freshRootData: any) => {
const copy = simpleCloneDeep(getValue<ViewStarStored>(freshRootData, dataPath!)!);
setData(copy);
if (copy !== undefined && copy !== null) {
// There are edge cases, e.g. when a row is opened in a dialog and an operation causes the row
// to be removed from the original table. In cases when the instance coming from a relation
// effectively gets removed we cannot null out our local data, because it results in the page crashing.
setData(copy);
}
});
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -387,7 +387,12 @@ export default function {{ pageName page }}(props: {{ pageName page }}Props) {
if (rootPageId && dataPath && isDraft) {
subscriptionRef.current = subscribe(`${rootPageId}:refreshed`, async (freshRootData: any) => {
const copy = simpleCloneDeep(getValue<{{ dialogDataType page }}>(freshRootData, dataPath!)!);
setData(copy);
if (copy !== undefined && copy !== null) {
// There are edge cases, e.g. when a row is opened in a dialog and an operation causes the row
// to be removed from the original table. In cases when the instance coming from a relation
// effectively gets removed we cannot null out our local data, because it results in the page crashing.
setData(copy);
}
});
}

Expand Down

0 comments on commit dfc345a

Please sign in to comment.