Skip to content

fix: spurious "New version released" prompt when editing notes - #1799

Closed
barrulus wants to merge 1 commit into
masterfrom
fix/notes-editor-preload-dialog
Closed

barrulus wants to merge 1 commit into
masterfrom
fix/notes-editor-preload-dialog

Conversation

@barrulus

@barrulus barrulus commented Sep 4, 2026

Copy link
Copy Markdown
Collaborator

Fixes #1660.

Root cause

vite build wraps every dynamic import(), including the /* @vite-ignore */ one the notes editor used to fetch TinyMCE from azgaar.github.io, in its preload helper. When that import fails the helper fires vite:preloadError, and app-shell.ts has answered that event with the "New version released" reload prompt since #1560. So the prompt appears whenever the TinyMCE fetch fails, not only after a release.

In the desktop app the fetch always fails: the CSP added in 1.149.0 allows scripts from the app itself only. Hence the prompt on every note, and the rich editor silently falling back to a plain textarea. On the web the same prompt shows whenever azgaar.github.io is unreachable.

Fix

  • TinyMCE already ships in public/libs. Load that copy with a classic <script> through the shared loadScript util, which cloud.ts and export.ts each carried a private copy of. A script tag failure stays local to the notes editor, and the desktop CSP allows it.
  • Loaded from a script tag, TinyMCE 7 infers a .min suffix from its own file name and requests theme.min.min.js. Its tinyMCEPreInit hook sets the base and an empty suffix up front, replacing the old _setBaseUrl call. The retry-with-random-hash workaround only made sense for a cached module import and is gone.

Tests

tests/e2e/notes-editor.spec.ts: one test aborts the TinyMCE request and asserts no reload prompt and a working plain editor (fails before this change), the other asserts the rich editor renders from the bundled copy. Note the first only exercises the bug on a built bundle, since the dev server does not wrap imports; the CI suite runs on a preview build.

Verified on the production web build. The packaged desktop app itself was not launched; its path differs only by the CSP the bundled copy now satisfies.

Vite wraps every dynamic import() in its preload helper, whose failure
fires vite:preloadError and, through the app shell, the "New version
released" reload prompt. The notes editor imported TinyMCE from
azgaar.github.io that way, so any failed fetch showed the prompt. In the
desktop app the CSP blocks remote scripts, so it showed on every note
and the editor silently degraded to a plain textarea.

TinyMCE already ships in public/libs. Load that copy with a classic
script through the shared loadScript util, which cloud.ts and export.ts
each carried their own copy of. TinyMCE infers a ".min" suffix from its
own file name and doubles it onto theme and plugin names, so the pre-init
hook sets the base and an empty suffix instead of _setBaseUrl.

Fixes #1660
@netlify

netlify Bot commented Sep 4, 2026

Copy link
Copy Markdown

Deploy Preview for afmg ready!

Name Link
🔨 Latest commit 1e4ccaa
🔍 Latest deploy log https://app.netlify.com/projects/afmg/deploys/6a9b153d818b8000081c5a84
😎 Deploy Preview https://deploy-preview-1799--afmg.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@Azgaar

Azgaar commented Sep 5, 2026

Copy link
Copy Markdown
Owner

@barrulus, why not just npm install tinymce@^7, I mean moving it from script load to package.json?

@Azgaar
Azgaar self-requested a review September 5, 2026 10:35
@Azgaar

Azgaar commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Alternatively - if you know a better and mush more lightweight WYSIWYG editor - replace tinymce with it.

@barrulus

barrulus commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

@barrulus, why not just npm install tinymce@^7, I mean moving it from script load to package.json?

because this was a fix not refactor :) I will have a look at that today - will let you know what I think/find before I do anythign further on this one

@Azgaar

Azgaar commented Sep 5, 2026

Copy link
Copy Markdown
Owner

Maybe Quill 2 or something less known

@barrulus

barrulus commented Sep 5, 2026

Copy link
Copy Markdown
Collaborator Author

Maybe Quill 2 or something less known

From Quill:

Granular access to the editor's content, changes and events through a simple API. Works consistently and deterministically with JSON as both input and output.

This is very interesting, especially at the electron level... Local LLM to populate edit and update notes....

@barrulus barrulus mentioned this pull request Sep 5, 2026
@barrulus
barrulus marked this pull request as draft September 5, 2026 11:21
@github-actions github-actions Bot added the theme: markers-zones Markers / Notes / Zones label Sep 8, 2026
@barrulus

Copy link
Copy Markdown
Collaborator Author

Superseded by #1807: the notes editor now runs on a bundled Quill 2, so the remote TinyMCE import() that triggered the spurious "New version released" prompt (#1660) no longer exists. Closing without merging.

@barrulus barrulus closed this Sep 10, 2026
@github-project-automation github-project-automation Bot moved this from Backlog to Done in FMG dev board Sep 10, 2026
@barrulus
barrulus deleted the fix/notes-editor-preload-dialog branch September 10, 2026 08:41
@barrulus barrulus moved this from Done to Archive in FMG dev board Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

theme: markers-zones Markers / Notes / Zones

Projects

Status: Archive

Development

Successfully merging this pull request may close these issues.

Spurious "New version released" dialog when adding a note in the Electron desktop client

2 participants