Skip to content

fix(insights): Prevent duplicate rows in footer of Slow Queries widget #93453

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Conversation

gggritso
Copy link
Member

Closes DAIN-630: Widget footers incorrectly render duplicate rows when changing filters. There were two errors:

  1. The enabled: check wasn't working correctly. data is always an array, and !!([]) evalues to true so the query was always enabled. This causes an extra query with no conditions to fire every time the filters change
  2. The key of the items in the footer was not unique, since multiple spans of the same normalized description can come back between requests and between renders. Duplicate keys can cause duplicate items in the list in some cases (like this case)

This PR fixes both those errors. This is a little tough to see locally since it's obscured by DAIN-629.

gggritso added 2 commits June 12, 2025 13:22
`!!([])` evaluates to `true`, so this query is _always_ enabled. We need
to check the length of the response instead.
@gggritso gggritso requested a review from ArthurKnaus June 12, 2025 17:26
@gggritso gggritso requested a review from a team as a code owner June 12, 2025 17:26
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 12, 2025
Copy link
Member

@ArthurKnaus ArthurKnaus left a comment

Choose a reason for hiding this comment

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

thx for fixing! 🚀

@gggritso gggritso merged commit 540ef12 into master Jun 13, 2025
44 checks passed
@gggritso gggritso deleted the georgegritsouk/dain-630-widget-footers-incorrectly-render-duplicate-rows-when branch June 13, 2025 13:08
billyvg pushed a commit that referenced this pull request Jun 18, 2025
#93453)

Closes [DAIN-630: Widget footers incorrectly render duplicate rows when
changing
filters](https://linear.app/getsentry/issue/DAIN-630/widget-footers-incorrectly-render-duplicate-rows-when-changing-filters).
There were two errors:

1. The `enabled: ` check wasn't working correctly. `data` is _always_ an
array, and `!!([])` evalues to `true` so the query was always enabled.
This causes an extra query with no conditions to fire every time the
filters change
2. The `key` of the items in the footer was not unique, since multiple
spans of the same normalized description can come back between requests
and between renders. Duplicate keys can cause duplicate items in the
list in some cases (like this case)

This PR fixes both those errors. This is a little tough to see locally
since it's obscured by DAIN-629.
andrewshie-sentry pushed a commit that referenced this pull request Jun 19, 2025
#93453)

Closes [DAIN-630: Widget footers incorrectly render duplicate rows when
changing
filters](https://linear.app/getsentry/issue/DAIN-630/widget-footers-incorrectly-render-duplicate-rows-when-changing-filters).
There were two errors:

1. The `enabled: ` check wasn't working correctly. `data` is _always_ an
array, and `!!([])` evalues to `true` so the query was always enabled.
This causes an extra query with no conditions to fire every time the
filters change
2. The `key` of the items in the footer was not unique, since multiple
spans of the same normalized description can come back between requests
and between renders. Duplicate keys can cause duplicate items in the
list in some cases (like this case)

This PR fixes both those errors. This is a little tough to see locally
since it's obscured by DAIN-629.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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