Repository navigation
fix(build): load the editor logic from a hashed chunk - #392
Merged
Merged
Conversation
The mind map element imports mindmap.js lazily, and it was still built as the entry files_mindmap-mindmap.mjs, whose name never changes. The server lets browsers cache it for six months and the dynamic import carries no version, so after an update browsers kept running the old file next to the new init script, and opening a mind map failed with "Cannot read properties of undefined (reading 'init')". Nothing loads it as an entry since #375, so build it as a normal chunk, whose name carries a content hash. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
1 task done
AndyScherzinger
added a commit
that referenced
this pull request
Oct 18, 2026
The viewer and public share entries import mindmap.js, which was still built as the entry files_mindmap-mindmap.mjs, whose name never changes. The server lets browsers cache it for six months and the import carries no version, so after an update browsers could keep running the old file next to the new entries. Nothing loads it as an entry, so build it as a normal chunk, whose name carries a content hash. Same fix as #392 on main. Assisted-by: Claude Code:claude-opus-5-5 Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
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.
Opening a mind map can fail after an update with "Cannot read properties of undefined (reading 'init')" and "We were unable to display the requested file", in Files and on public shares.
Since #375 the mind map element loads the editor logic lazily with
import('../mindmap.js').mindmap.jswas still a build entry, so it came out asjs/files_mindmap-mindmap.mjs, a name that never changes. The server sends it withCache-Control: max-age=15778463(six months), and unlike scripts added throughUtil::addScript()the dynamic import carries no?v=version. A browser that cached the file from an earlier build therefore keeps using it next to the new init script, and the import resolves to a module that doesn't match.Nothing loads
mindmap.jsas an entry anymore, so it is removed from the entries. It is now emitted as a normal chunk,js/mindmap-<hash>.chunk.mjs, whose name changes whenever its content does, like every other chunk the init script imports.Testing: found on the Nextcloud 36 dev instance after several rebuilds, where a browser with a warm cache failed to open the public share while fresh browsers opened it. With this change the init script imports
./mindmap-<hash>.chunk.mjs, andjs/viewer.jsis unchanged. Vitest, lint and the build pass.🤖 AI (if applicable)