Skip to content

Commit 4e32e9c

Browse files
fix: guard granularity URL sync until router is ready (#2293)
## Summary Fixes `href interpolation failed` error when loading a dashboard page directly (e.g. `/dashboards/<id>` without query params). The granularity sync effect was calling `setGranularity` before `router.isReady`, causing nuqs to build a URL with an unresolved `[dashboardId]` segment. Added a `router.isReady` guard to match the pattern used by the existing dashboard initialization effect. Before: <img width="1614" height="649" alt="Screenshot 2026-05-15 at 2 36 52 PM" src="https://github.com/user-attachments/assets/d36a5e12-4524-4f55-9567-0905c1ed3841" /> Afte <img width="1797" height="691" alt="Screenshot 2026-05-15 at 2 38 19 PM" src="https://github.com/user-attachments/assets/db4285ae-7ec2-44a1-9c2f-ab0c6e99d2bd" /> r:
1 parent 46c1459 commit 4e32e9c

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@hyperdx/app": patch
3+
---
4+
5+
Fix `href interpolation failed` error when loading a dashboard page directly without query params by guarding the granularity URL sync until the router is ready.

‎packages/app/src/DBDashboardPage.tsx‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,10 +1329,14 @@ function DBDashboardPage({ presetConfig }: { presetConfig?: Dashboard }) {
13291329
const watchedGranularity = useWatch({ control, name: 'granularity' });
13301330

13311331
useEffect(() => {
1332-
if (watchedGranularity && watchedGranularity !== granularity) {
1332+
if (
1333+
router.isReady &&
1334+
watchedGranularity &&
1335+
watchedGranularity !== granularity
1336+
) {
13331337
setGranularity(watchedGranularity as SQLInterval);
13341338
}
1335-
}, [watchedGranularity, granularity, setGranularity]);
1339+
}, [router.isReady, watchedGranularity, granularity, setGranularity]);
13361340

13371341
const [displayedTimeInputValue, setDisplayedTimeInputValue] =
13381342
useState('Past 1h');

0 commit comments

Comments
 (0)