Skip to content

feat(render-html): Serialize collapse state in URL and support popstate navigation#48

Merged
mhiro2 merged 1 commit into
mainfrom
feat/url-state-collapse-and-popstate
Apr 10, 2026
Merged

feat(render-html): Serialize collapse state in URL and support popstate navigation#48
mhiro2 merged 1 commit into
mainfrom
feat/url-state-collapse-and-popstate

Conversation

@mhiro2

@mhiro2 mhiro2 commented Apr 10, 2026

Copy link
Copy Markdown
Owner

Summary

  • Serialize table collapse state into the URL hash (c parameter) so it can be shared and
    bookmarked
  • Expose a runtime API (runtime.collapse.getCollapsed / runtime.collapse.setCollapsed) for
    programmatic collapse control
  • Support browser back/forward navigation via popstate with proper pushState/replaceState
    distinction

Changes

  • c748081 : feat(render-html): serialize collapse state in URL and support popstate navigation
    • Add ViewerCollapseApi interface with getCollapsed/setCollapsed methods to
      viewer_api.ts, extending ViewerRuntime and ViewerModule types
    • Implement applyCollapseState in collapse.ts for programmatic collapse/expand, register
      the collapse module in the viewer runtime, and emit relune:collapse-changed events on toggle
    • Serialize collapsed table IDs as the c hash parameter in url_state.ts, restore them on
      page load, and validate IDs against known table IDs; introduce scheduleDiscreteWrite using
      history.pushState for user actions while keeping history.replaceState for continuous viewport
      changes; add popstate listener with restoringFromPopstate guard to avoid duplicate history
      entries

@mhiro2 mhiro2 self-assigned this Apr 10, 2026
@mhiro2 mhiro2 added the enhancement New feature or request label Apr 10, 2026
…te navigation

Add collapsed tables to URL hash (`c` param) so shared links preserve
collapse state. Use pushState for discrete viewer changes (selection,
search, filter, collapse) to enable browser back/forward, while keeping
replaceState for continuous viewport pan/zoom to avoid history flooding.
@mhiro2
mhiro2 force-pushed the feat/url-state-collapse-and-popstate branch from e7ebca9 to c748081 Compare April 10, 2026 21:10
@github-actions

Copy link
Copy Markdown

Code Metrics Report

main (a9d8da7) #48 (6ad409a) +/-
Coverage 94.1% 94.1% 0.0%
Test Execution Time 1m34s 1m38s +4s
Details
  |                     | main (a9d8da7) | #48 (6ad409a) | +/-  |
  |---------------------|----------------|---------------|------|
  | Coverage            |          94.1% |         94.1% | 0.0% |
  |   Files             |             77 |            77 |    0 |
  |   Lines             |          29895 |         29895 |    0 |
  |   Covered           |          28148 |         28148 |    0 |
- | Test Execution Time |          1m34s |         1m38s |  +4s |

Reported by octocov

@mhiro2
mhiro2 merged commit d4daf7a into main Apr 10, 2026
3 checks passed
@mhiro2
mhiro2 deleted the feat/url-state-collapse-and-popstate branch April 10, 2026 21:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant