Repository navigation
Shareable URL with the right anchor set to each graph view - #1196
EngCaioFonseca wants to merge 1 commit into
Conversation
…exact shared graph view Clicking Share on any graph card builds a URL that carries the whole share (selected repos/orgs + target graph) as a versioned gzip+base64url payload — no database. Opening the link restores the selection through the existing search pipeline and scrolls to the exact shared graph: the URL fragment is the card's real DOM id (page-vizid) and a clientside handler waits for the client-side render, re-centering through the async graph-load reflow. Decode path is hardened (input-length cap, bounded gunzip, payload shape validation) since ?state= is user-controlled. A DB-backed short-URL layer (?s=) follows in a separate PR.
|
Can you include more details in the PR description for how this works? like is this relying on specific/documented dash features to do the "jump to"? I like the end behavior of this (it even updated the scroll position when a graph above it loaded and got taller and shifted the layout!), but the size of this diff makes it hard to be thorough with the code review step in the time window i have available. Not every day that the PR is tested and working before code review happens but i guess such is the strange timeline of software we are now in |
| VALID_GRAPH_REGISTRY: dict[str, list[str]] = { | ||
| "/repo_overview": [ | ||
| "code-languages", | ||
| "ossf-scorecard", | ||
| "package-version", | ||
| "repo-general-info", | ||
| ], | ||
| "/contributions": [ |
There was a problem hiding this comment.
We can do this dynamically in the VisualizationAIO - which has access to the ID being given to it for nav purposes
There was a problem hiding this comment.
updating the share logic to use the id=(self.nav_id if self.nav_id is not None else f"{self.page}-{self.viz_id}"), logic from vizaio should eliminate the need for this registry
There was a problem hiding this comment.
if this wont affect the "jump to graph" can we move the state things to their own PR?
|
Okay, taking a deeper look into the workings of the anchor fix in this branch vs how it works on prod, is that the real DOM id is indeed necessary, but not sufficient. When we test on prod a url like: ...affiliation#affiliation-gh-org-affiliation, it fails because of when the browser scrolls: the native hash-scrolling happens once, at document load - at that moment Dash hasn't client-side-rendered the page yet, so the element doesn't exist. Even though it is the correct ID, there's nothing to scroll to, silent no-op. It works on this branch, because the clientside scroll handler is keyed on url.hash, independent of the ?state=, so once the card appears, it goes on to center it. for the v1, we don't need the state, like I mentioned, just the handler. |
This PR implements a shareable URL button, where the user can share the url for each graph view on the app. Previous anchor was implemented using only the page view, instead of the right anchor id, which is set as viz + page_view id.
Pull Request Change Description
Generative AI disclosure
Please select one option:
If AI tools were used, please provide details below:
- What tools were used? Claude Fable 5
- How were these tools used? Draft, review.
- Did you review these outputs before submitting this PR? Yes, reviewed and tested.