Repository navigation
Share link: modern tools write their entry and read it back on load - #643
Open
BhattaraiSijan wants to merge 2 commits into
Open
BhattaraiSijan wants to merge 2 commits into
BhattaraiSijan wants to merge 2 commits into
Conversation
Open
5 tasks
Open
5 tasks
…rn entry A modern tool that throws or returns no string no longer breaks Copy link for the whole app. Each modern entry's text is percent-encoded before the entries are joined and the query's own encodeURI pass, and tool:getUrlState decodes it, so a tool's text may hold commas, ampersands and hashes. Classic entries are unchanged. The bus doc states that the answer lasts the whole session and is to be applied once.
BhattaraiSijan
force-pushed
the
feat/tools-url-state
branch
from
November 19, 2026 16:40
ca4d014 to
4e42a39
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.
Part of #613. Groundwork for #616. Carved from #618 at Sandesh's request.
Summary
The share link's
tools=entry lets a tool save its state into the link so the link reopens the same way. It was assembled from a list only the classic layout's init fills, so in the modern layout no tool could write into a link, and nothing on the read side handed a tool its entry back. This PR gives the modern layout both halves.getToolsUrl(), built over its own registry of loaded tool ids, with the sameid$stringcontract the classic one has. The classic controller is untouched and does not learn modern tools exist. (This replaces the first cut on Share: exports and links show a comparison the way the screen does #618, which pushed modern tools into the classic controller's private list.)mmgisAPI, which readsLayers_at module load, andLayers_already reachesQueryURLthroughTimeUIandMap_, so the cycle closes andL_is undefined at load. Instead the modern layout hands the controller toQueryURLat mount and clears it at teardown, the same handoffUserInterfaceModern_already does formmgisAPI_._pluginControllerfor the same reason. In the classic layout the property stays null and nothing changes.tool:getUrlStatebus request, registered at mission load next totool:getVars, answers the text a tool'sgetUrlString()wrote under its module name, or null. The shared adapter gets ammgisGetToolUrlStatewrapper.getToolsUrl()skips a tool whosegetUrlString()throws or returns no string, with a warning naming it, instead of failing Copy link for the whole app.encodeURIComponent-ed before the entries are joined on,and the query gets itsencodeURIpass.getSingleQueryVariableundoes the outer layer andL_.getToolUrlStatethe inner one, so, & # $ |in a tool's text come back whole. Classic entries are written and read raw as before; the decode falls through to the raw text when an entry isn't valid percent-encoding.Semantics, stated
tool:getUrlStateanswers the opening link's text for the whole session. It does not expire. A tool that restores itself on every mount would reapply the link's state each time, so apply it once, on first mount. The push-model store that makes apply-once the default, and stops core calling into plugin code at all, is the follow-up under #613; this PR hardens the pull model until then.Not in this PR
Test plan
npx vitest run: 222 files, 3808 tests pass;npx tsc --noEmitcleanundefinedare left out; a tool text with, & # $ |stays one entry; the reader decodes it and passes a raw classic entry through; a full round trip throughwriteCoordinateURLandgetSingleQueryVariablereads both a classic and an encoded modern entry back wholetools=unchanged from development🤖 Generated with Claude Code