Skip to content

fix(files): open public mind map shares reliably on Nextcloud 32 - #389

Merged
AndyScherzinger merged 1 commit into
mainfrom
fix/legacy-action-race
Oct 17, 2026
Merged

AndyScherzinger merged 1 commit into
mainfrom
fix/legacy-action-race

Conversation

@AndyScherzinger

Copy link
Copy Markdown
Member

On Nextcloud 32, opening a public file share of a mind map sometimes showed the file list instead of the mind map, mostly in Firefox (8–9 of 10 page loads opened it). It happens on every build since #375, including before #387 and #388.

Files 32 opens the shared file through its default action, and it looks that action up exactly once when it opens a file from the URL (handleOpenFile() in FilesListVirtual.vue). Since #375 the 32-only action was registered from a lazily loaded chunk (import('./legacyFileAction.js')), so whenever that chunk arrived after the lookup, there was no default action and Files showed the list.

The action is now registered synchronously from the init script. Importing @nextcloud/files-legacy statically would have added about 397 kB (134 kB gzip) to every page on every version. Instead the action is a plain object in the window._nc_fileactions registry of @nextcloud/files 3, which is all registerFileAction() writes to. Its FileAction class only wraps those properties, and Files 32 reads them directly, never checking the class. The DefaultType.HIDDEN and Permission.READ values are inlined. @nextcloud/files-legacy is dropped, and the init script grows by 0.5 kB.

Testing:

  • 32 in Firefox, public file share: 20 of 20 page loads opened the mind map, against 8–9 of 10 before.
  • Open from Files, edit and save, and public share pass on 32, 34 and 36, in Chromium and Firefox.
  • A new unit test covers registering once, keeping existing actions, and enabled().

🤖 AI (if applicable)

  • The content of this PR was partly or fully generated using AI (N/A)

Files 32 looks up the default action once when it opens a file from the
URL, as on a public file share. The action was registered from a lazily
loaded chunk, so when that chunk came late, as it sometimes did in
Firefox, the share page showed the file list instead of the mind map.

Register it synchronously from the init script instead. To keep the init
script small it is a plain object in the window._nc_fileactions registry
of @nextcloud/files 3, whose FileAction only wraps these properties, and
@nextcloud/files-legacy is dropped.

Assisted-by: Claude Code:claude-opus-5-5
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
@nextcloud-command nextcloud-command added the AI assisted This PR contains AI-assisted commits label Oct 17, 2026
@AndyScherzinger
AndyScherzinger merged commit 9ab95a7 into main Oct 17, 2026
8 checks passed
@AndyScherzinger
AndyScherzinger deleted the fix/legacy-action-race branch October 17, 2026 17:19
@AndyScherzinger AndyScherzinger added this to the v0.1.4 milestone Oct 17, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

AI assisted This PR contains AI-assisted commits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants