🐛(frontend) prevent share modal crash on team-based accesses#768
Open
maartendra wants to merge 1 commit into
Open
🐛(frontend) prevent share modal crash on team-based accesses#768maartendra wants to merge 1 commit into
maartendra wants to merge 1 commit into
Conversation
ItemShareModal builds a member list keyed by access.user.id, but team-based accesses grant a whole team and have a null user. The first team access hit `access.user.id` and threw "null is not an object", unmounting the entire modal (a client-side exception) for any item shared with a team. Skip team-based accesses (identified by their non-empty `team`) in the per-user member list. Team accesses are not yet rendered as rows (follow-up); this only stops the crash.
|
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.



ItemShareModalbuilds its member list keyed byaccess.user.id, but a team-based access grants a whole team and has a nulluser. The first team access hitsaccess.user.idand throwsTypeError: null is not an object, so the ErrorBoundary unmounts the entire share modal ("a client-side exception has occurred") for any item that is shared with a team.Fix
Skip team-based accesses (identified by their non-empty
team) when building the per-user member list, so the nulluseris never dereferenced.Team-based accesses are not yet rendered as rows in the modal (a follow-up); this change only stops the crash so the modal opens and per-user sharing keeps working on items that also have a team access.
Test
teamset anduser: null), then open the share modal: onmainit crashes; with this change it opens normally.