Repository navigation
fix(assets): non-media assets, assets:// paths on Linux, theme before first paint, published pages icons - #13898
Open
yuxi-liu-wired wants to merge 4 commits into
Open
yuxi-liu-wired wants to merge 4 commits into
yuxi-liu-wired wants to merge 4 commits into
Conversation
This was referenced Oct 28, 2026
1 of 2 tasks
yuxi-liu-wired
force-pushed
the
fix/dbtest-assets
branch
3 times, most recently
from
November 3, 2026 12:02
458e0cf to
7b03117
Compare
yuxi-liu-wired
force-pushed
the
fix/dbtest-assets
branch
8 times, most recently
from
November 18, 2026 14:01
637d4cd to
9a66e4f
Compare
…render In a page exported with "Export public pages" (SPA HTML), the Status property showed no icon: Todo, Doing, Done and the other status values rendered as empty. The status icons (Backlog, InProgress50, ...) are custom icons that exist only in static/js/tabler.ext.js, which the app's own index.html loads. The generated index.html never included that script, so the icon lookup fell back to an empty font icon. The script was dropped when the exported script list was reworked. Add tabler.ext.js to the script list in publishing-html. The file is already copied with the static js directory. Test: published-html-loads-tabler-ext-js builds the HTML for a small graph and checks that the script list contains static/js/tabler.ext.js. Fixes logseq/db-test#1412
Uploading a .txt, .xlsx or .docx file to a block copied the file into the graph's assets folder but the block only showed the file name as plain text, in editing mode and after leaving it. block-title routed only pdf asset blocks to asset-cp, and the block content path only images, audio and video. Every other asset type fell through to text-block-title, which prints the title. asset-link already has a branch that opens the file (Electron) or downloads it (web), but nothing reached it for these types. block-title now sends every asset block that is not an image, audio or video to asset-cp, which includes pdf as before. Media blocks are unchanged: their content path renders the media and keeps the editable title below it. Test: non-media-asset-title-renders-as-asset-link-test renders block-title for pdf, txt, xlsx and docx asset blocks and expects the asset component, and for png, mp3 and mp4 expects the title only. Fixes logseq/db-test#1437
…g slash Adding an asset on Linux logged "resolve-assets-url Unknown assets url assets://home/..." in the console, and the handler passed a relative path to Electron. The renderer builds assets:///home/me/graph/assets/a.png, but the assets scheme is registered as standard, so Chromium reads the first path segment as the host and the handler receives assets://home/me/graph/assets/a.png. After the prefix is removed the path has no leading slash, which the handler treated as an unknown URL. Only Windows had a branch for this form (UNC paths). Move the path resolution to electron.assets-protocol/url->file-path. A path without a leading slash is an absolute path on macOS and Linux, and stays a UNC path on Windows. Test: url->file-path-test covers the host-eaten form, the three-slash form, percent escapes with a query and fragment, and the Windows UNC and drive forms. Fixes logseq/db-test#1231
With the dark theme selected, Logseq opened as a white window and switched to dark only after the app had loaded, which can take seconds with plugins. The window is shown as soon as index.html has painted, but data-theme is set by the app only after it mounts, so until then the page uses the light default variables. index.html now has an inline script that reads the stored theme and the system-theme flag from localStorage and sets data-theme and the dark class on the root element before the first paint. It follows the same rules as the initial theme state: the system theme follows prefers-color-scheme, and a first start uses it on macOS and Windows and light on Linux. Test: stored-theme-is-applied-before-the-app-mounts-test runs the boot script from resources/index.html against fake browser globals for a stored dark theme, a stored light theme with a dark system, the system theme in both directions, and a first start on macOS and Linux. Fixes logseq/db-test#962
yuxi-liu-wired
force-pushed
the
fix/dbtest-assets
branch
from
November 18, 2026 14:39
9a66e4f to
c8acbb7
Compare
This branch has not been deployed
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.
Fixes logseq/db-test#1437, Fixes logseq/db-test#1231, Fixes logseq/db-test#962, Fixes logseq/db-test#1412.
One commit per issue, each with its test.
#1437: non-media asset files render as plain text
What the user sees: dropping or uploading a .txt, .xlsx or .docx file copies it to the graph's assets folder, but the block shows only the file name as plain text, in editing mode and after leaving it.
Cause:
block-titlesent onlypdfasset blocks toasset-cp, and the block content path only images, audio and video (img-audio-video?). Every other type fell through totext-block-title.asset-linkalready has the open (Electron) and download (web) branch for these types, but nothing reached it. The "second upload inserts nothing" part is by design:new-asset-blockwarns that the asset already exists and inserts no block.Change:
block-titlesends every asset block that is not an image, audio or video toasset-cp(pdf as before). Media blocks are unchanged, their content path renders the media and keeps the editable title below it.Test:
non-media-asset-title-renders-as-asset-link-test(pdf, txt, xlsx, docx expect the asset component; png, mp3, mp4 still get the title only). On master it fails for txt, xlsx and docx.Not checked at runtime: I did not drop a file into a running app.
#1231: Electron
assets://handler gets the host eating the leading slashWhat the user sees: adding an asset on Linux logs
resolve-assets-url Unknown assets url assets://home/...in the console, and the handler passes a relative path to Electron.Cause: the renderer builds
assets:///home/me/graph/assets/a.png, but theassetsscheme is registeredstandard, so Chromium readshomeas the host and the handler receivesassets://home/me/.... After removing the prefix the path has no leading slash and fell to the:elsebranch. Only Windows had a branch for this form (UNC paths).Change: the path resolution moves to
electron.assets-protocol/url->file-path(no Electron requires, so it can be unit tested). A path without a leading slash is an absolute path on macOS and Linux and stays a UNC path on Windows. The handler inelectron.corecalls it.Test:
url->file-path-test(host-eaten form, three-slash form, percent escapes with query and fragment, Windows UNC and drive forms). On master the host-eaten form returns the relative path and the test fails.Not checked at runtime: I did not run Electron and did not log
request.url; the two-slash form comes from the reporter's log. Chromium also lowercases a host, so a first path segment with capital letters (for example/Media/...on Linux) would reach the handler lowercased; that cannot be recovered in the handler and is not changed here.#962: Electron window is white before the theme is applied
What the user sees: with the dark theme the window opens white and switches to dark after the app has loaded, which takes seconds with plugins.
Cause: the window is shown on
ready-to-show, afterindex.htmlhas painted, butdata-themeis set by the app only after it mounts (theme.cljs), so until then the page uses the light defaults.Change:
resources/index.htmlgets an inline script (#theme-boot) that reads the storedthemeandsystem-theme?from localStorage and setsdata-themeand thedarkclass on the root element before the first paint. It mirrors the initial state infrontend.state: the system theme followsprefers-color-scheme, a first start uses it on macOS and Windows and light on Linux. The window's:backgroundColoris not changed: the window is hidden untilready-to-show, and the main process cannot read the renderer's stored theme.Test:
stored-theme-is-applied-before-the-app-mounts-testruns the boot script fromresources/index.htmlagainst fake browser globals (stored dark, stored light with a dark system, system theme both ways, first start on macOS and Linux). On master the file has no boot script and every assertion fails.Not checked at runtime: I did not start Electron with a dark theme and look at the first paint.
#1412: exported public pages never load
tabler.ext.jsWhat the user sees: in a page exported with "Export public pages" (SPA HTML) the Status property shows no icon.
Cause: the status icons (
Backlog,InProgress50, ...) are custom icons defined only instatic/js/tabler.ext.js, whichresources/index.htmlloads. The generatedindex.htmlnever included it, so the icon lookup falls back to an empty font icon. It was dropped by the "SPA HTML export renders blank page" rework (b517311).Change:
publishing-htmllistsstatic/js/tabler.ext.js(deferred, like the other scripts that are not needed before main.js). The file is already copied with the static js directory.Test:
published-html-loads-tabler-ext-js(deps/publishing, nbb) builds the HTML for a small graph and checks the script list. On master it fails.Proof
:else pathbranch, since the fix extracts the function) and the test bundle rebuilt. The new tests fail without the fixes (electron.assets-protocol-test2 failures,frontend.components.block.asset-title-test6 failures,frontend.theme-boot-test8 failures), pass with them (3 tests, 28 assertions, 0 failures), andpnpm cljs:run-teston the final tree has 0 failures exceptblock-property-query-performance, a timing test that failed under load;frontend.db.query-dsl-testandfrontend.worker.search-test(the serial namespaces the runner had not reached) pass on rerun. I used one combined revert instead ofprove-fix.shper file.html-testfails on master, andpnpm testin deps/publishing passes (10 tests, 38 assertions).Not in this PR
(or width 250 asset-width)): not changed, because it needs a maintainer's choice and does not reproduce as a code defect.250is the default display width on purpose: the sameimg-metadatais also applied to the real<img>, so with storedasset/widthandasset/heightthe placeholder and the image have the same size, andasset-widthbeing unreachable in theorchanges nothing. Images that were never rendered (for example after an import) have no stored size, so neither the placeholder nor the unloaded<img>can reserve a height untilasset-containermeasures it on first render; fixing the jump means either guessing an aspect ratio for the placeholder or storing the size at import, which is a design decision, and a scroll jump cannot be reproduced in a unit test.