Skip to content
Snippets Groups Projects
Unverified Commit f7bf0234 authored by Kamil Mielnik's avatar Kamil Mielnik Committed by GitHub
Browse files

Add custom warning message when leaving editing an existing SQL question (#34084)

* Use LeaveConfirmationModal in QueryBuilder

* Add isLocationAllowed prop to LeaveConfirmationModal

* Do not route-block running modified native question

* Fix typo

* Introduce explanatory variables

* Move updating URL during question creation to QueryBuilder

* Schedule navigation to after re-render so that LeaveConfirmationModal prop has a chance to update

* Add a test for unsaved changes warning

* Introduce useCallbackEffect

* Refactor QueryBuilder to use useCallbackEffect

* Refactor ActionCreator to use useCallbackEffect

* Fix useCallbackEffect typing

* Move onSubmit out of the scheduled callback to reduce probability of race conditions

* Add comments explaining useCallbackEffect usage

* Improve JSDocs

* Add a test for running modified question

* Update button query to more accessible one

* Add a test for saving a modified question

* Update test names

* Add a test for leaving with no changes

* Remove isDirty-related no-change assertions, as isDirty flag does not work reliably
- Question.prototype.isDirtyComparedTo would return true because edited "question"
  would have extra "description: null" attribute and no "name" compared to
  "originalQuestion" (see "getIsDirty")

* Move useCallbackEffect to its own directory

* Add test setup for useCallbackEffect

* Add a test case for scheduling

* Add a test for scheduling callback effect

* Do not disable navigation in models
- this is a temporary condition until #33793 is implemented

* Remove redundant _.noop

* Rename isScheduled to isCallbackScheduled

* Remove redundant route

* Remove redundant code

* Add a test for custom warning modal when saving edited question as a new one
parent 86f405a0
No related branches found
No related tags found
No related merge requests found
Showing
with 435 additions and 64 deletions
Loading
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment