[ZEPPELIN-6591] Discard unsaved note permission edits on Cancel - #5510
Merged
Merged
Conversation
voidmatcha
approved these changes
Sep 29, 2026
Member
|
Merged into master (d3e932f). |
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.
What is this PR for?
In the New UI note permissions panel, each select was bound with
[(ngModel)]directly to thepermissionsobject owned byNotebookComponent. Editing a list mutated the parent's object, and Cancel only hid the panel. Reopening the panel reused the same mutated object, so it showed the unsaved edits whileGET /api/notebook/{noteId}/permissionsstill returned the saved values. A later Save could also submit those stale edits.This PR makes the panel edit a detached draft:
NotebookPermissionsComponentbuildsdraftPermissionsfrom the input when it initializes and when a newpermissionsinput arrives. All four lists are copied, so in-place array edits do not reach the parent either.permissionsSaved.NotebookComponenthandles it by callinggetPermissions(note), so the saved state (andisOwner) is refreshed from the backend.permissionsBackis removed because the draft replaces it.As the issue notes, reassigning the child's
@Input()would not repair an object already mutated in the parent. With this change the parent object is never mutated, and the panel is destroyed on close, so reopening always starts from the parent's saved state.What type of PR is it?
Bug Fix
Todos
What is the Jira issue?
ZEPPELIN-6591
How should this be tested?
cd zeppelin-web-angular npm run test:shell -- permissions.component.spec.tsQuestions: