Fix/<a> having dashboard by identifier as link - #73
Merged
imenattatra merged 3 commits intoJul 6, 2026
Conversation
Add GET /api/dashboards/by_url_identifier/<url_identifier>, served by the existing DashboardResource, so a dashboard can be fetched by its Metr url_identifier (the current JSON endpoint only resolves by id/slug). Access stays fully org-scoped, same as the id/slug path: - the route is registered via add_org_resource, so it lives under the org slug and current_org is resolved from it; - get_by_url_identifier_and_org_or_404 filters by org_id (404 otherwise); - require_dashboard_group_access enforces per-dashboard access. Update add_allowed_widgets_info to accept the new route's kwarg and, when the lookup wasn't by numeric id, resolve the allowed-widgets query id from the response — id/slug paths are unchanged. Add tests for the happy path and unknown identifier (404).
Dashboard.get accepts a urlIdentifier and calls the new by_url_identifier endpoint; id/slug lookups unchanged.
In-app clicks on <a> links to /dashboards/by_url_identifier/... were
intercepted by Redash's global client-side navigation handler, so the
request never reached the server-side redirect. With no matching client
route, the greedy dashboard route tried to load an invalid id and showed
an error (it only worked after a refresh, which hit the server 302).
Register a client route that renders DashboardPage resolved by
url_identifier, then rewrites the URL to the canonical {id}-{slug}.
Fixes metr-systems/backlog#4919
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.
Closes https://github.com/metr-systems/backlog/issues/4919
AI Disclaimer: Yes claude , assisted in finding the fix and its implementation
Summary
Clicking a dashboard link that uses
by_url_identifier(e.g. from inside a visualization) showed an error page, and only worked after a manual refresh. This PR fixes it so the dashboard opens directly, with no refresh.Code Strategy
The
by_url_identifierredirect only existed server-side. When such a link is clicked inside the app, Redash's global navigation handler routes it client-side, so the request never reaches the server and the redirect never runs — hence the error (a refresh worked because it's a real server request).Rather than force a full page reload, we resolve it in-app:
/api/dashboards/by_url_identifier/<url_identifier>to fetch the dashboard by its identifier (org-scoped, same access checks as the id/slug path).Dashboard.getcan call it viaurlIdentifier.DashboardPageand rewrites the URL to the canonical{id}-{slug}.QA
How did you test it? Keep your future self in mind to help debug things later.
Notes:
This is a fix and will be deployed today