[fix] Unsaved changes alert disable on preview view#857
Conversation
nemesifier
left a comment
There was a problem hiding this comment.
There's a few issues with this solution:
- A user may have done unsaved changes, hit the preview and then close the window by mistake, the unsaved changes logic is disabled and the window will be closed, which is not what we want.
- Opening and closing the preview can be done also with keyboard shortcuts, opening the preview with ALT and P does not trigger this code.
Rather than a solution, to me this feels like hiding dust under the carpet: the dust will just keep increasing until it's too much. Please let's refrain from this kind of solution and let's debug the code.
if you add these at line 52-53:
console.log(initialValue);
console.log(currentValues[name]);The console log shows that the initial value is null, while after the preview the value is and empty string, the two values do not match.
Therefore, we must investigate how it works and understand why null changes to empty string after the preview, with that information we can look for possible solutions, for example:
- maybe whatever is changing the value from null to empty string shouldn't happen
- or maybe when comparing values of Select2 elements, we can consider
nulland empty string to be the same
Which one of the two is right? I think it's premature to decide without further information.
939bf95 to
bc45b3b
Compare
|
@nemesifier Updated with the changes. Kindly review it again! |
Fixes #824