Skip to content

[Bug] Model-run deep-links redirect to parent route on fresh page load #2182

@Chuhan-Peng

Description

@Chuhan-Peng

Describe the bug
When clicking a model-run deep-link from a Slack alert (e.g. https://#/report/model-runs/model.my_project.my_model/), the app immediately redirects to #/report/model-runs, losing the specific model context.
The same URL works correctly when pasted into an already-open browser tab.
Test-run deep-links (e.g. #/report/test-runs/test.my_project.../) are unaffected and work correctly in both cases.

To Reproduce
Steps to reproduce the behavior:

  1. Configure --report-url and trigger a model failure to generate a Slack alert
  2. Click the "View model runs" link in the Slack message (opens a new browser tab)
  3. Observe the URL in the new tab

Expected behavior
The report navigates to the specific model's run history page at #/report/model-runs/<model_unique_id>/

Current behaviour
The app redirects to the parent page #/report/model-runs, losing the model context. Pasting the same URL into an existing tab (where the SPA is already loaded) works correctly.

Screenshots
N/A

Environment

  • Elementary CLI (edr) version: 0.23.1
  • Elementary dbt package version: 0.23.0
  • dbt version: 1.10.8
  • Data warehouse: BigQuery
  • Infrastructure: Production deployment via Dagster Cloud, report hosted on GCS bucket with public website serving

Additional context
Root cause
The model-runs detail component uses a redirect guard useEffect that checks whether the URL's model ID exists in tableData. The bug is in the DPn hook, which returns [] for tableData while the asset metadata API call (xz()) is still fetching on initial page load:

// DPn — returns empty array while isFetching, triggering the redirect guard prematurely 
c = useMemo(() => !a || isFetching ? [] : a.map(...), ...)

// Guard fires with tableData = [], [].some(...) = false → redirect 
useEffect(() => { 
   urlId && (tableData.some(R => R.unique_id === urlId) || navigate(`/report/model-runs?...`))
}, [urlId, tableData]) 

The test-runs hook (mMn) handles this correctly by falling back to the raw embedded report data while fetching, so the guard finds the ID and does not redirect.

Suggested fix
Either mirror the mMn (test-runs) pattern in DPn to return raw data while fetching instead of [], or guard the useEffect with the already-available isTableAssetsFetching flag (returned from DPn as m in the minified bundle, but currently unused in the redirect guard):

// Option 1 — guard the useEffect (isTableAssetsFetching is already in scope)                                                                                                                             
useEffect(() => {                                                                                                                                                                                         
  urlId && !isTableAssetsFetching && (tableData.some(...) || navigate(...))                                                                                                                               
}, [urlId, tableData, isTableAssetsFetching])                                                                                                                                                             
                                                                                                                                                                                                          
// Option 2 — mirror mMn: return raw data while fetching instead of []                                                                                                                                    
c = useMemo(() => { if (!modelRunsData || isFetching) return modelRunsData; ... }, ...)

Would you be willing to contribute a fix for this issue?
I would love to contribute but it seems the index.html is an artifect generated by the frontend code which isn't public.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions