Skip to content

ref(dashboards): migrate issues dataset to hook pattern#106780

Merged
DominikB2014 merged 11 commits intomasterfrom
dominikbuszowiecki/browse-254-migrate-issues-dataset-to-hook-pattern
Jan 29, 2026
Merged

ref(dashboards): migrate issues dataset to hook pattern#106780
DominikB2014 merged 11 commits intomasterfrom
dominikbuszowiecki/browse-254-migrate-issues-dataset-to-hook-pattern

Conversation

@DominikB2014
Copy link
Contributor

Same as #106779 but for issues dataset

@DominikB2014 DominikB2014 requested a review from a team as a code owner January 22, 2026 15:15
@linear
Copy link

linear bot commented Jan 22, 2026

@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jan 22, 2026
@DominikB2014 DominikB2014 marked this pull request as draft January 22, 2026 15:37
Use stable refs for fetchFnRef objects to enable proper queue deduplication.
Previously, new objects were created on each query execution, breaking the
queue's reference equality check and causing duplicate API calls.

- Create fetchFnRefsRef array using useRef to store stable refs
- Initialize refs in useMemo when queryKeys change
- Pass queryIndex to createQueryFn to use the correct stable ref
- Apply fix to both useIssuesSeriesQuery and useIssuesTableQuery

Fixes the issue identified by Cursor Bugbot where queue deduplication
was broken due to unstable ref objects.
Fix ESLint prefer-promise-reject-errors violations by wrapping
non-Error rejection values in Error objects.
…eryExtras

- Use `data` instead of `query` for table query params to match existing API patterns
- Flatten `queryExtras` into query params for series queries so `category` is at top level
@DominikB2014
Copy link
Contributor Author

@cursoragent review

@cursor
Copy link
Contributor

cursor bot commented Jan 27, 2026

Unable to authenticate your request. Please make sure to connect your GitHub account to Cursor. Go to Cursor

@DominikB2014
Copy link
Contributor Author

@cursor review

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Bugbot reviewed your changes and found no new issues!

Comment @cursor review or bugbot run to trigger another review on this PR

Removes GroupStore.add() side effect from transformIssuesResponseToTable
(making it a pure function) and moves it to a useEffect in
useIssuesTableQuery hook to avoid React warning about updating
a component while rendering a different component.
Copy link
Member

@narsaynorath narsaynorath left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a question about something new I saw

Comment on lines +139 to +143
const noop = () => Promise.resolve();
while (fetchFnRefsRef.current.length < keys.length) {
fetchFnRefsRef.current.push({current: noop});
}
fetchFnRefsRef.current.length = keys.length;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why does this adjustment need to happen for issues? I don't believe I saw this in your other PRs so I'm just trying to understand what we're trying to balance with this

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

THis was needed if the size the array changes, you might have fetchFnRefsRef.current[queryIndex] === undefined, the other datasets created the fetch functions on the fly within a useCallback.

I don't like this approach as much, so i'll update it to be consistent with the other datasets.

Copy link
Contributor

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

prevGroupDataRef.current[i] = data;
}
});
});
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

useEffect missing dependency array runs every render

Low Severity

The useEffect that populates GroupStore has no dependency array, causing it to run after every render. While the ref-based tracking (prevGroupDataRef) prevents duplicate GroupStore.add calls, the effect still executes unnecessarily on every re-render. Adding [queryResults] as a dependency would limit execution to only when query results actually change, following React best practices.

Fix in Cursor Fix in Web

@DominikB2014 DominikB2014 merged commit 384038c into master Jan 29, 2026
53 checks passed
@DominikB2014 DominikB2014 deleted the dominikbuszowiecki/browse-254-migrate-issues-dataset-to-hook-pattern branch January 29, 2026 15:43
priscilawebdev pushed a commit that referenced this pull request Feb 2, 2026
@github-actions github-actions bot locked and limited conversation to collaborators Feb 14, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants