IBX-7901: [UDW] Removing from bookmarks content is still visible on bookmark list #1209
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.
v4.6
Bookmarks are kept in other place than LoadedLocationsMapContext (which is modified after clicking "Remove from bookmarks", so bookmarks state has to be reload as well.
Bookmark children (BookmarksList and Browse) are rendered conditionally now on existing
restorationStateRef.current
.This ref is set on first call of useEffect when
markedLocationId
is cleared to be ready to work with bookmarks module.It serves as guardian - without it there's a moment, when
markedLocationId
has some garbage data from previous screen and this data is used inside bookmarks (in my case - in bookmarks list) and shows bugged screens therefore.How it worked:
BookmarksTabModule
(BTM) was initialized, there was some previous data inmarkedLocationId
BookmarksList
(BL) to be specific)markedLocationId
with previous data, because of it sth unexpected happenedmarkedLocationId
markedLocationId
has been changed - now everything SHOULD BE okmarkedLocationId
changed according to BL component, it loaded wrong data (it showed bookmarks twice in specific scenario)How it should work (and works after these changes):
BookmarksTabModule
(BTM) was initialized, there was some previous data inmarkedLocationId
restorationStateRef
which is set inside useEffect (from no2)markedLocationId
and setrestorationStateRef
restorationStateRef
exists, BTM renders its children as wellBookmarksList
(BL) was initialized, it was rendered at its useEffect was called, this time with emptymarkedLocationId
Checklist:
@ibexa/engineering
).