Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,13 @@ const DraggableItem = (props) => {
[expanded, props.type, props.id],
);

// Call updateQueryOnExpansion when expanded changes
// Call updateQueryOnExpansion when expanded changes; a row mounting collapsed would only re-set the parent id.
const mounted = useRef(false);
useEffect(() => {
updateQueryOnExpansion();
if (expanded || mounted.current) {
updateQueryOnExpansion();
}
mounted.current = true;
}, [expanded]);

// Create provided and snapshot objects compatible with the existing MappingRule component
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,9 @@ export const RuleEditorModel = ({ children }: RuleEditorModelProps) => {
stickyNotes: StickyNote[];
externalSavedState?: unknown;
}>();
const unsavedChanges = savedStatePosition !== "current" || (!savedOnce && ruleEditorContext.saveInitiallyEnabled);
// Nothing can be unsaved before the editor has loaded; reporting it would arm the navigation prompts meanwhile.
const unsavedChanges =
!initializing && (savedStatePosition !== "current" || (!savedOnce && ruleEditorContext.saveInitiallyEnabled));
const hotkeyContext = React.useContext(ReactFlowHotkeyContext);
const onRuleOperatorNodesChangeRef = React.useRef(ruleEditorContext.onRuleOperatorNodesChange);
onRuleOperatorNodesChangeRef.current = ruleEditorContext.onRuleOperatorNodesChange;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ describe("RuleBlockEditor integration", () => {
</RuleBlockEditorOptionalContextValue.Provider>,
);

await waitFor(() => expect(screen.getByRole("button", { name: "remove-normal-node" })).toBeInTheDocument());
await waitFor(() => expect(screen.getByRole("button", { name: "Save" })).toBeDisabled());
expect(screen.queryByTestId("context-overlay")).not.toBeInTheDocument();

Expand Down
Loading