Repository navigation
Fragment links: linkable app state and link manifests - #44
Merged
Merged
Conversation
Apps keep view state in the URL fragment, mirrored between the sandboxed iframe and the page URL. An app advertises its linkable views with a datasette-app-links JSON manifest, extracted into a new app_links table on every save. Adds the app_links agent tool, a hash option for app_debug, and direct navigation for same-origin links between apps. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Manifest descriptions are shown to models in line-based lists, so a newline could forge what looks like a separate entry. Collapse whitespace in descriptions and reject templates containing whitespace or control characters. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
The shim routed replaceState through the location.hash setter, which always adds a history entry, so an app keeping a search box in the fragment added a back button step per keystroke. Use location.replace() with the srcdoc document's own absolute URL, which is a fragment navigation that replaces the current entry. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
1.0a42 renders menu links with role="menuitem", so the exact-string assertion failed and the anonymous-user check could no longer fail. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
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.
Lets an app keep its view state in the URL fragment, and advertise which fragments it supports so other apps and datasette-agent can link to them.
What this adds
location.hashto the page URL and back, so app views can be bookmarked, shared and stepped through with the back button. Ordinary<a href="#/customer/42">links work inside the sandbox.history.pushState()/history.replaceState()now work with a fragment-only URL.replaceState()replaces the current history entry rather than adding one.app_linkstable on every HTML save, with a backfill for existing apps. External apps supply the same list asmetadata["links"].app_linkstool lists advertised links for apps the user can view, filterable by database/table.app_createand the edit tools report what the manifest advertises and any errors in it.app_debugtakes ahashargument. Referenced apps list their linkable views in the agent context.Notes for review
replaceState()useslocation.replace("about:srcdoc#..."). This is covered by Playwright tests in Chromium and was also run in WebKit. It has not been checked in Firefox - Playwright's Firefox would not launch on the development machine. The new path is only taken when the document URL is exactlyabout:srcdoc.Tests
275 unit tests and 21 Playwright tests pass locally.
🤖 Generated with Claude Code