[CORE-233] Fix option flickers while adding#37
Open
nikkalin1008 wants to merge 3 commits intomainfrom
Open
Conversation
3984186 to
e09794e
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
This PR addresses three bugs: (1) options flickering when adding new choices due to unstable React keys, (2) an error when adding an "others" option due to misplaced key prop, and (3) the OAuth authentication popup not appearing centered on screen.
Changes:
- Fixed OAuth popup centering by computing
left/topcoordinates based on screen position and outer window dimensions before callingwindow.open. - Fixed flickering and "other" option error by correcting the
keyprop placement from the innerOptionsInputto the outerdiv, and refactoringsyncQuestionFromApito preserve client-side option arrays instead of overwriting them with server-returned choices (which had different IDs, causing remounts). - Removed now-outdated JSDoc comments on
OptionandDetailOptiontypes that referenced the old strategy of using API choice IDs.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
src/shared/components/AccountButton/AccountButton.tsx |
Centers the OAuth popup window on screen using computed left/top from screen position and window dimensions |
src/features/form/components/AdminFormDetailPages/types/question.ts |
Removes JSDoc comments about stable ID strategy that no longer applies |
src/features/form/components/AdminFormDetailPages/components/OptionsQuestion.tsx |
Moves key prop from inner OptionsInput to outer div wrapper, fixing "other" option rendering bug |
src/features/form/components/AdminFormDetailPages/SectionEditPage.tsx |
Refactors syncQuestionFromApi to preserve client-side options/detailOptions arrays (preventing flicker) and uses immutable spread-based state update |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Type of changes
Purpose