-
Notifications
You must be signed in to change notification settings - Fork 630
fix(splits): Make split assignment idempotent #10252
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
Conversation
| }, {} as SplitState); | ||
| }, [splits, selectedPartialExamples]); | ||
| const handleSplitToggle = useCallback( | ||
| (selectedId: string) => { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
| (selectedId: string) => { | |
| (selectedSplitId: string) => { |
| if (!open && shouldKeepMenuOpenRef.current) { | ||
| shouldKeepMenuOpenRef.current = false; | ||
| setIsMenuOpen(true); | ||
| return; | ||
| } | ||
| shouldKeepMenuOpenRef.current = false; | ||
| setIsMenuOpen(open); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we add a comment here explaining the need for this?
| const [isMenuOpen, setIsMenuOpen] = useState(false); | ||
| const shouldKeepMenuOpenRef = useRef(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Probably worth a comment.
| }, [splits, selectedPartialExamples]); | ||
| const handleSplitToggle = useCallback( | ||
| (selectedId: string) => { | ||
| onRequestKeepMenuOpen(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might be worth a comment.
Note
Replaces add/remove split mutations with a single idempotent set-example-splits operation and updates the UI to use it with improved menu behavior.
addDatasetExamplesToDatasetSplitsandremoveDatasetExamplesFromDatasetSplitsinputs/mutations/payloads.setDatasetExampleSplitswithSetDatasetExampleSplitsInputandSetDatasetExampleSplitsMutationPayloadreturning a singleexample.src/phoenix/server/api/mutations/dataset_split_mutations.py):set_dataset_example_splitsto atomically set splits for anexample(validates IDs, deletes missing, inserts new; usesjoinedloadandtuple_).app/src/pages/examples/ExamplesSplitMenu.tsx):ExamplesSplitMenuSetDatasetExampleSplitsMutationand update apply logic to send fullsplitIdsperexampleId.onActionhandler and checkbox state sync.Written by Cursor Bugbot for commit 18bb22d. This will update automatically on new commits. Configure here.