Skip to content

Shareable URL with the right anchor set to each graph view - #1196

Open
EngCaioFonseca wants to merge 1 commit into
devfrom
share_url_graph_view
Open

EngCaioFonseca wants to merge 1 commit into
devfrom
share_url_graph_view

Conversation

@EngCaioFonseca

@EngCaioFonseca EngCaioFonseca commented Jul 6, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • This contribution was NOT assisted or created by Generative AI tools.
  • This contribution was assisted or created by Generative AI tools.

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.

…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.
@EngCaioFonseca EngCaioFonseca self-assigned this Jul 6, 2026
@EngCaioFonseca EngCaioFonseca moved this from Backlog to Testing | Waiting on PR response | Blocked in Aspen Project Board Jul 6, 2026
@MoralCode

Copy link
Copy Markdown
Contributor

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

Comment on lines +13 to +20
VALID_GRAPH_REGISTRY: dict[str, list[str]] = {
"/repo_overview": [
"code-languages",
"ossf-scorecard",
"package-version",
"repo-general-info",
],
"/contributions": [

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.

We can do this dynamically in the VisualizationAIO - which has access to the ID being given to it for nav purposes

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.

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

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.

if this wont affect the "jump to graph" can we move the state things to their own PR?

@EngCaioFonseca

EngCaioFonseca commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor Author

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Development

Successfully merging this pull request may close these issues.

2 participants