Skip to content

refactor: graph view V2 - #12604

Merged
tiensonqin merged 78 commits into
masterfrom
refactor/graph-view
May 10, 2026
Merged

tiensonqin merged 78 commits into
masterfrom
refactor/graph-view

Conversation

@tiensonqin

@tiensonqin tiensonqin commented May 8, 2026 •

Copy link
Copy Markdown
Contributor

Summary:

- Replace /graph route with a new Pixi-based global graph implementation in ClojureScript.

- Build graph data from db-worker only (no UI DB writeback) and default to tags+objects with a toggle for all pages.

- Add fast scene rendering for large graphs with indexed hit-testing, zoom/pan, node dragging, and click/shift+click node actions.

- Introduce dynamic label management (zoom hysteresis, viewport culling, overlap control, hover-emphasis) and fix hook lifecycle cleanup issues.

- Refresh graph UI styling to full-container layout, dot-first settings control, and Logseq button usage.

- Add/expand tests for global graph modes, node actions, and Pixi label/visibility logic.

- Update graph-related dependencies/lockfile as part of the new implementation.
- Dragging a node now pulls connected nodes with depth-based weights for easier structure exploration.

- Labels are rendered only for currently visible node dots; hover no longer reveals hidden-node titles.

- Hovered node title remains promoted in foreground while respecting visibility constraints.

- Add logic/test coverage for connected drag weights and updated label text behavior.
Summary:
- Move Graph V2 node layout into graph pixi logic.
- Use d3-force link, charge, center, collision, and y forces instead of the hand-written ring/spiral layout.
- Add coverage that linked graph nodes settle closer than an unlinked island.

Dependency:
- Verified d3-force is already latest at 3.0.0.

Tests:
- bb dev:test -v frontend.extensions.graph-pixi-logic-test
- bb dev:test -v frontend.common.graph-view-v2-test
- pnpm install --frozen-lockfile --lockfile-only

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Refactors Logseq’s graph view into a new “V2” implementation: a new Pixi.js-based renderer + a new settings UI, alongside a reworked graph builder that supports :tags-and-objects vs :all-pages modes and updated i18n keys.

Changes:

  • Replaces the legacy pixi-graph-fork graph renderer with a custom Pixi.js v8 renderer and extracted pure logic module + tests.
  • Introduces a new global graph UI (frontend.components.graph/global-graph) with per-graph persisted settings (localStorage) and tag-based filtering for :tags-and-objects mode.
  • Updates graph building logic (frontend.common.graph-view) to default global mode to tags+objects, adds view-mode metadata, and adds performance-oriented paths + tests.

Reviewed changes

Copilot reviewed 53 out of 54 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
typos.toml Removes a typo override entry.
src/test/frontend/extensions/graph_test.cljs Adds unit coverage for canvas-style.
src/test/frontend/extensions/graph_pixi_logic_test.cljs Adds extensive unit/perf tests for new Pixi graph logic helpers.
src/test/frontend/components/graph_test.cljs Adds tests for graph settings/tag filtering helpers in the new graph UI.
src/test/frontend/components/graph_actions_test.cljs Adds tests for node activation behavior (open vs sidebar).
src/test/frontend/common/graph_view_v2_test.cljs Adds tests for new global graph defaults, view modes, filtering, and performance.
src/resources/dicts/zh-hant.edn Removes old graph/cmdk graph-filter strings (graph view V2 key set changes).
src/resources/dicts/zh-cn.edn Removes old strings and adds new graph V2 settings strings.
src/resources/dicts/uk.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/tr.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/sk.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/ru.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/pt-pt.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/pt-br.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/pl.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/nl.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/nb-no.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/ko.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/ja.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/it.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/id.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/fr.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/fa.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/es.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/en.edn Removes old strings and adds new graph V2 settings strings.
src/resources/dicts/de.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/cs.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/ca.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/ar.edn Removes old graph/cmdk graph-filter strings.
src/resources/dicts/af.edn Removes old graph/cmdk graph-filter strings.
src/main/frontend/util.cljc Removes unused regex escaping helpers and a removed JS util binding.
src/main/frontend/ui.cljs Removes legacy slider component (no longer used by graph UI).
src/main/frontend/state.cljs Removes graph search filter state + legacy graph settings accessors.
src/main/frontend/schema/handler/common_config.cljc Drops schema entries for removed legacy graph config keys.
src/main/frontend/routes.cljs Routes /graph to the new frontend.components.graph/global-graph.
src/main/frontend/handler/search.cljs Simplifies clearing search mode (graph search mode removed).
src/main/frontend/handler/graph.cljs Removes legacy n-hops filtering helper (old graph UI removed).
src/main/frontend/extensions/graph/pixi/logic.cljs Adds extracted pure logic for layout/visibility/label selection/interaction.
src/main/frontend/extensions/graph/pixi.cljs Replaces old renderer with a full Pixi.js v8 implementation (pan/zoom, labels, hit-testing, drag, etc.).
src/main/frontend/extensions/graph.css Adds new graph V2 layout + settings panel styles; adjusts global graph container sizing.
src/main/frontend/extensions/graph.cljs Reworks graph-2d to render via the new Pixi container renderer + hooks.
src/main/frontend/components/svg.cljs Removes unused SVG helpers (used by removed legacy graph UI).
src/main/frontend/components/page.css Removes legacy graph filter CSS blocks.
src/main/frontend/components/page.cljs Removes legacy global graph UI and connects page graph to new activation handler.
src/main/frontend/components/graph.cljs Adds new graph V2 UI with settings panel, view-mode selection, and tag filtering.
src/main/frontend/components/graph_actions.cljs Adds shared node activation handlers (redirect vs sidebar).
src/main/frontend/components/container.css Enables margin-less/full-height layouts for routes that request it.
src/main/frontend/components/cmdk/core.cljs Removes graph-search mode behaviors from cmdk.
src/main/frontend/common/graph_view.cljs Adds new global graph builder modes, icon/kind metadata, and performance paths.
src/main/frontend/colors.cljs Removes unused accent-color helper (and its dependencies).
package.json Removes pixi-graph-fork, upgrades Pixi.js dependency to v8.
deps/db/src/logseq/db/common/sqlite_cli.cljs Adds ^js type hints for better-sqlite3 interop.
deps/common/resources/templates/config.edn Removes legacy graph config documentation (old settings removed).
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

(contains? excluded-page-ids page-id))
(and (not builtin-pages?)
(contains? build-in-pages page-name))
(and (not orphan-pages?)
(true? (get page :logseq.property/exclude-from-graph-view)))
(and (not builtin-pages?)
(contains? build-in-pages (:block/name page)))
(and (not orphan-pages?)
Comment on lines +8 to +19
(defn next-visibility-state
[{:keys [label-visible?]} scale
{:keys [show-label-scale hide-label-scale]}]
(let [detail-expanded? true
label-visible? (cond
(and (not label-visible?)
(>= scale show-label-scale)) true
(and label-visible?
(<= scale hide-label-scale)) false
:else label-visible?)]
{:detail-expanded? detail-expanded?
:label-visible? label-visible?}))
@tiensonqin
tiensonqin merged commit 1f9c017 into master May 10, 2026
26 checks passed
@tiensonqin
tiensonqin deleted the refactor/graph-view branch May 10, 2026 15:26
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 1, 2026
* feat(graph): rebuild global graph view with Pixi

Summary:

- Replace /graph route with a new Pixi-based global graph implementation in ClojureScript.

- Build graph data from db-worker only (no UI DB writeback) and default to tags+objects with a toggle for all pages.

- Add fast scene rendering for large graphs with indexed hit-testing, zoom/pan, node dragging, and click/shift+click node actions.

- Introduce dynamic label management (zoom hysteresis, viewport culling, overlap control, hover-emphasis) and fix hook lifecycle cleanup issues.

- Refresh graph UI styling to full-container layout, dot-first settings control, and Logseq button usage.

- Add/expand tests for global graph modes, node actions, and Pixi label/visibility logic.

- Update graph-related dependencies/lockfile as part of the new implementation.

* enhance(graph): improve drag exploration and label visibility

- Dragging a node now pulls connected nodes with depth-based weights for easier structure exploration.

- Labels are rendered only for currently visible node dots; hover no longer reveals hidden-node titles.

- Hovered node title remains promoted in foreground while respecting visibility constraints.

- Add logic/test coverage for connected drag weights and updated label text behavior.

* enhance(graph): use d3 force layout

Summary:
- Move Graph V2 node layout into graph pixi logic.
- Use d3-force link, charge, center, collision, and y forces instead of the hand-written ring/spiral layout.
- Add coverage that linked graph nodes settle closer than an unlinked island.

Dependency:
- Verified d3-force is already latest at 3.0.0.

Tests:
- bb dev:test -v frontend.extensions.graph-pixi-logic-test
- bb dev:test -v frontend.common.graph-view-v2-test
- pnpm install --frozen-lockfile --lockfile-only

* fix: graph view interactions

* enhance: speed up large graph view

* enhance: speed up tags graph

* enhance: speed up tags layout

* enhance: bound tags force layout

* enhance: speed up graph opening

* fix: keep graph objects visible when zoomed out

* fix: resize graph with sidebars

* enhance: select graph nodes

* fix: refine graph selection controls

* support icons

* fix: sharpen graph node icons

* enhance(graph): update graph v2 settings

* fix: re-render graph when theme changes

* enhance(graph): remove legacy graph view

* fix: typo

* fix: improve graph view

* test: cover graph view improvements

* enhance: improve graph view

* test: cover graph time travel behavior

* enhance: refine graph time travel

* test: cover graph layout controls

* enhance: add graph layout controls

* test: cover graph highlight controls

* fix: refine graph highlight controls

* test: cover edge label alignment

* fix: align graph edge labels

* test: keep graph lines visible on highlight

* fix: keep graph lines visible on highlight

* fix: show graph lines by default

* test: filter graph lines on highlight

* fix: filter graph lines on highlight

* test: keep graph depth incremental

* fix: update graph depth incrementally

* test: cover graph label link occlusion

* fix: occlude graph links behind labels

* test: cover graph edge visibility defaults

* fix: smooth graph edges on highlight

* test: cover graph arrow toggle

* fix: toggle graph arrows

* test: cover reciprocal graph edge offsets

* fix: separate reciprocal graph edges

* test: cover duplicate graph edge runs

* fix: dedupe graph edge render runs

* test: cover graph tag clusters

* enhance: cluster graph tags layout

* test: cover graph tag cluster colors

* fix: color graph tag clusters by title

* test: cover subdued graph node colors

* fix: mute graph node colors

* feat: grid layout

* add more options

* enhance(graph): drill into tags on zoom

* map-like navigation

* mod+click to preview node

* edge enhancements

* more tweaks

* fix: block preview

* enhance(graph): speed up large graph layout

* fix: improve graph mode switching ux

* fix: speed up graph view switching

* fix: optimize large all-pages graph render

* fix: speed up graph data build

* fix: collapse graph tag settings on mode switch

* enhance: refine graph panel width

* fix: improve graph zoom performance

* fix: satisfy graph lint

* fix: open graph nodes by uuid

---------

Co-authored-by: rcmerci <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* feat(graph): rebuild global graph view with Pixi

Summary:

- Replace /graph route with a new Pixi-based global graph implementation in ClojureScript.

- Build graph data from db-worker only (no UI DB writeback) and default to tags+objects with a toggle for all pages.

- Add fast scene rendering for large graphs with indexed hit-testing, zoom/pan, node dragging, and click/shift+click node actions.

- Introduce dynamic label management (zoom hysteresis, viewport culling, overlap control, hover-emphasis) and fix hook lifecycle cleanup issues.

- Refresh graph UI styling to full-container layout, dot-first settings control, and Logseq button usage.

- Add/expand tests for global graph modes, node actions, and Pixi label/visibility logic.

- Update graph-related dependencies/lockfile as part of the new implementation.

* enhance(graph): improve drag exploration and label visibility

- Dragging a node now pulls connected nodes with depth-based weights for easier structure exploration.

- Labels are rendered only for currently visible node dots; hover no longer reveals hidden-node titles.

- Hovered node title remains promoted in foreground while respecting visibility constraints.

- Add logic/test coverage for connected drag weights and updated label text behavior.

* enhance(graph): use d3 force layout

Summary:
- Move Graph V2 node layout into graph pixi logic.
- Use d3-force link, charge, center, collision, and y forces instead of the hand-written ring/spiral layout.
- Add coverage that linked graph nodes settle closer than an unlinked island.

Dependency:
- Verified d3-force is already latest at 3.0.0.

Tests:
- bb dev:test -v frontend.extensions.graph-pixi-logic-test
- bb dev:test -v frontend.common.graph-view-v2-test
- pnpm install --frozen-lockfile --lockfile-only

* fix: graph view interactions

* enhance: speed up large graph view

* enhance: speed up tags graph

* enhance: speed up tags layout

* enhance: bound tags force layout

* enhance: speed up graph opening

* fix: keep graph objects visible when zoomed out

* fix: resize graph with sidebars

* enhance: select graph nodes

* fix: refine graph selection controls

* support icons

* fix: sharpen graph node icons

* enhance(graph): update graph v2 settings

* fix: re-render graph when theme changes

* enhance(graph): remove legacy graph view

* fix: typo

* fix: improve graph view

* test: cover graph view improvements

* enhance: improve graph view

* test: cover graph time travel behavior

* enhance: refine graph time travel

* test: cover graph layout controls

* enhance: add graph layout controls

* test: cover graph highlight controls

* fix: refine graph highlight controls

* test: cover edge label alignment

* fix: align graph edge labels

* test: keep graph lines visible on highlight

* fix: keep graph lines visible on highlight

* fix: show graph lines by default

* test: filter graph lines on highlight

* fix: filter graph lines on highlight

* test: keep graph depth incremental

* fix: update graph depth incrementally

* test: cover graph label link occlusion

* fix: occlude graph links behind labels

* test: cover graph edge visibility defaults

* fix: smooth graph edges on highlight

* test: cover graph arrow toggle

* fix: toggle graph arrows

* test: cover reciprocal graph edge offsets

* fix: separate reciprocal graph edges

* test: cover duplicate graph edge runs

* fix: dedupe graph edge render runs

* test: cover graph tag clusters

* enhance: cluster graph tags layout

* test: cover graph tag cluster colors

* fix: color graph tag clusters by title

* test: cover subdued graph node colors

* fix: mute graph node colors

* feat: grid layout

* add more options

* enhance(graph): drill into tags on zoom

* map-like navigation

* mod+click to preview node

* edge enhancements

* more tweaks

* fix: block preview

* enhance(graph): speed up large graph layout

* fix: improve graph mode switching ux

* fix: speed up graph view switching

* fix: optimize large all-pages graph render

* fix: speed up graph data build

* fix: collapse graph tag settings on mode switch

* enhance: refine graph panel width

* fix: improve graph zoom performance

* fix: satisfy graph lint

* fix: open graph nodes by uuid

---------

Co-authored-by: rcmerci <[email protected]>
devin-ai-integration Bot pushed a commit that referenced this pull request Oct 8, 2026
* feat(graph): rebuild global graph view with Pixi

Summary:

- Replace /graph route with a new Pixi-based global graph implementation in ClojureScript.

- Build graph data from db-worker only (no UI DB writeback) and default to tags+objects with a toggle for all pages.

- Add fast scene rendering for large graphs with indexed hit-testing, zoom/pan, node dragging, and click/shift+click node actions.

- Introduce dynamic label management (zoom hysteresis, viewport culling, overlap control, hover-emphasis) and fix hook lifecycle cleanup issues.

- Refresh graph UI styling to full-container layout, dot-first settings control, and Logseq button usage.

- Add/expand tests for global graph modes, node actions, and Pixi label/visibility logic.

- Update graph-related dependencies/lockfile as part of the new implementation.

* enhance(graph): improve drag exploration and label visibility

- Dragging a node now pulls connected nodes with depth-based weights for easier structure exploration.

- Labels are rendered only for currently visible node dots; hover no longer reveals hidden-node titles.

- Hovered node title remains promoted in foreground while respecting visibility constraints.

- Add logic/test coverage for connected drag weights and updated label text behavior.

* enhance(graph): use d3 force layout

Summary:
- Move Graph V2 node layout into graph pixi logic.
- Use d3-force link, charge, center, collision, and y forces instead of the hand-written ring/spiral layout.
- Add coverage that linked graph nodes settle closer than an unlinked island.

Dependency:
- Verified d3-force is already latest at 3.0.0.

Tests:
- bb dev:test -v frontend.extensions.graph-pixi-logic-test
- bb dev:test -v frontend.common.graph-view-v2-test
- pnpm install --frozen-lockfile --lockfile-only

* fix: graph view interactions

* enhance: speed up large graph view

* enhance: speed up tags graph

* enhance: speed up tags layout

* enhance: bound tags force layout

* enhance: speed up graph opening

* fix: keep graph objects visible when zoomed out

* fix: resize graph with sidebars

* enhance: select graph nodes

* fix: refine graph selection controls

* support icons

* fix: sharpen graph node icons

* enhance(graph): update graph v2 settings

* fix: re-render graph when theme changes

* enhance(graph): remove legacy graph view

* fix: typo

* fix: improve graph view

* test: cover graph view improvements

* enhance: improve graph view

* test: cover graph time travel behavior

* enhance: refine graph time travel

* test: cover graph layout controls

* enhance: add graph layout controls

* test: cover graph highlight controls

* fix: refine graph highlight controls

* test: cover edge label alignment

* fix: align graph edge labels

* test: keep graph lines visible on highlight

* fix: keep graph lines visible on highlight

* fix: show graph lines by default

* test: filter graph lines on highlight

* fix: filter graph lines on highlight

* test: keep graph depth incremental

* fix: update graph depth incrementally

* test: cover graph label link occlusion

* fix: occlude graph links behind labels

* test: cover graph edge visibility defaults

* fix: smooth graph edges on highlight

* test: cover graph arrow toggle

* fix: toggle graph arrows

* test: cover reciprocal graph edge offsets

* fix: separate reciprocal graph edges

* test: cover duplicate graph edge runs

* fix: dedupe graph edge render runs

* test: cover graph tag clusters

* enhance: cluster graph tags layout

* test: cover graph tag cluster colors

* fix: color graph tag clusters by title

* test: cover subdued graph node colors

* fix: mute graph node colors

* feat: grid layout

* add more options

* enhance(graph): drill into tags on zoom

* map-like navigation

* mod+click to preview node

* edge enhancements

* more tweaks

* fix: block preview

* enhance(graph): speed up large graph layout

* fix: improve graph mode switching ux

* fix: speed up graph view switching

* fix: optimize large all-pages graph render

* fix: speed up graph data build

* fix: collapse graph tag settings on mode switch

* enhance: refine graph panel width

* fix: improve graph zoom performance

* fix: satisfy graph lint

* fix: open graph nodes by uuid

---------

Co-authored-by: rcmerci <[email protected]>
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.

3 participants