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

Fix error handling on nested create modals #1286

Merged
merged 3 commits into from
Jan 3, 2025

Conversation

nas-tabchiche
Copy link
Contributor

  • Remove obsolete workaround
  • chore: Remove dead code

This is actually an issue on some nested create forms that still use an
old workaround that we implemented a while back to fix modals not
closing and success toasts not being dispatched, at the expense of
backend validation errors being displayed.
I do not remember how this was solved, however this workaround is
definitely not longer needed, and can just be YEETed on sight.
@nas-tabchiche nas-tabchiche changed the title CA 737 error handling on nested modals Fix error handling on nested create modals Dec 31, 2024
Comment on lines -56 to -78
let { form: deleteForm, message: deleteMessage } = {
form: {},
message: {}
};

let { form: createForm, message: createMessage } = {
form: {},
message: {}
};

// NOTE: This is a workaround for an issue we had with getting the return value from the form actions after switching pages in route /[model=urlmodel]/ without a full page reload.
// invalidateAll() did not work.
$: {
({ form: createForm, message: createMessage } = superForm(data.scenarioCreateForm, {
onUpdated: ({ form }) =>
handleFormUpdated({ form, pageStatus: $page.status, closeModal: true })
}));
({ form: deleteForm, message: deleteMessage } = superForm(data.scenarioDeleteForm, {
onUpdated: ({ form }) =>
handleFormUpdated({ form, pageStatus: $page.status, closeModal: true })
}));
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important changes are these, the remainder of the PR is dead code removal.

Copy link
Collaborator

@Mohamed-Hacene Mohamed-Hacene left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

0k

@Mohamed-Hacene Mohamed-Hacene merged commit 670be9f into main Jan 3, 2025
17 checks passed
@Mohamed-Hacene Mohamed-Hacene deleted the CA-737-error-handling-on-nested-modals branch January 3, 2025 09:40
@github-actions github-actions bot locked and limited conversation to collaborators Jan 3, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants