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

Reset puzzle modal form upon successful submission. #2287

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jpd236
Copy link
Contributor

@jpd236 jpd236 commented Oct 3, 2024

See #2274

@jpd236
Copy link
Contributor Author

jpd236 commented Dec 21, 2024

This causes a regression that can lead to errors when saving existing puzzles. Simple repro steps:

  • From the puzzle list page, click the edit button on a puzzle.
  • Save without making any changes
  • Repeat above steps again

I think the problem is that upon successful save, the form's title state is set to "" (and titleDirty set to false) in the onSubmit callback. So if we reload the dialog for the same puzzle and try to save again, the title doesn't get reset.

Need to find a better way to clear state here.

@jpd236 jpd236 force-pushed the reset-puzzle-modal branch from d11bc6c to be3d675 Compare December 21, 2024 23:09
@jpd236
Copy link
Contributor Author

jpd236 commented Dec 21, 2024

I think this is now fixed. PuzzleModalForm now exposes a reset() function to reset the form state. PuzzleListPage calls reset upon successful puzzle creation. This leaves the behavior unchanged for editing existing puzzles, but keeps the clearing for new puzzles.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant