You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Dashboard: share_url() without data gives a URL whose updates fail #143
share_url() on a Dashboard without data returns a URL that opens but never shows data. Its docstring says the method neither starts a server nor registers the source, and that the server must already serve source_name. That reads as "no data needed", but data is needed.
The cause is Dashboard.to_spec(): src = source_name if self._backend_lf is not None else None. In a browser, GET /view returns 200. Then each /dashboard/update returns 500 (KeyError: 't' in trace/line.py, get_aggregation_spec, for a line), and the console logs "initial load failed, panels are empty". Nothing fails in Python.
It is easy to hit in web apps (#73, #141). The page script builds the URL, and the server registers the data in another file or process. The web apps guide now works around it: build the Dashboard on a lazy scan of the same file.
Proposal
Honour source_name in to_spec(), with or without data. This changes share_url(), save_spec(), and to_spec() together. The server already checks axis-link types against the registered schema on /view and on each update (_check_link_types), so the client-side link check can stay limited to dashboards with data. show() registers no source for a dashboard without data, so it passes no source_name and keeps its behaviour.
The alternative is to raise ValueError in share_url() when the dashboard has no data. That is smaller, but it keeps the second scan in web apps for no reason.
Done when
Dashboard().share_url(source_name="x") gives figures with source == "x", and the page loads data from a server that serves x.
A test covers it.
The web apps guide drops the "same data" rule, or limits it to dashboards with linked axes.
Activity