Skip to content

fix: wait for the sidebar resource before rendering the shares panel - #3639

Open
fredrikblau wants to merge 1 commit into
opencloud-eu:mainfrom
fredrikblau:fix/3574-space-members-null-resource
Open

fredrikblau wants to merge 1 commit into
opencloud-eu:mainfrom
fredrikblau:fix/3574-space-members-null-resource

Conversation

@fredrikblau

Copy link
Copy Markdown
Contributor

Description

On a fresh load of the Spaces page, clicking "Show members" on a space tile crashed the sidebar with Cannot read properties of null (reading 'canShare').

The cause is the order in which the sidebar loads. The tile button selects the space and opens the space-share panel in one step. That space's graphPermissions aren't loaded yet: the selectedResourcesIds watcher in Projects.vue has only just started loading them. So the FileSideBar watcher awaits loadGraphPermissionsTask before it calls setLoadedResource. The loading overlay in SideBarPanels doesn't unmount the panels, so SharesPanel renders SpaceMembers during that await with the injected resource still null. The other entry points (space ⋮ → Members, the header link, Details → Members) select the space first, so its permissions are already loaded and the resource is set without waiting.

SharesPanel now shows its existing loader until the sidebar resource is set. The fix sits in SharesPanel rather than in SpaceMembers or useCanShare, so it also covers FileShares and FileLinks, which read the same injected resource.

Related Issue

How Has This Been Tested?

  • test environment: Node 24.20.0, pnpm test:unit packages/web-app-files/tests/unit/components/SideBar/Shares/
  • test case 1: new SharesPanel spec, resource injected as ref(null) with showSpaceMembers: the loader is shown and space-members isn't rendered. Fails without the change.
  • test case 2: the existing SharesPanel, SpaceMembers, FileShares and FileLinks specs still pass (153 tests).
  • eslint and prettier are clean on the touched files. vue-tsc on web-app-files reports only the 3 errors that are already on main.

Types of changes

  • Bugfix
  • Enhancement (a change that doesn't break existing code or deployments)
  • Breaking change (a modification that affects current functionality)
  • Technical debt (addressing code that needs refactoring or improvements)
  • Tests (adding or improving tests)
  • Documentation (updates or additions to documentation)
  • Maintenance (like dependency updates or tooling adjustments)

On a fresh load of the Spaces page, the space's graph permissions are not
loaded yet, so FileSideBar awaits them before setting the sidebar resource.
The panels stay mounted under the loading overlay during that wait, so
opening the members panel from a space tile rendered SpaceMembers with a
null resource and crashed in canShare. Show the loader until the resource
is set.

Fixes opencloud-eu#3574
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Show members" on a space tile doesn't open the sidebar

1 participant