Skip to content

perf(logs): Prevent search query builder rerenders on auto-refresh#110320

Merged
nsdeschenes merged 2 commits intomasterfrom
nd/LOGS-601/fix-tracemetrics-stop-search-query-builder-from-rendering-on-auto-refresh
Mar 11, 2026
Merged

perf(logs): Prevent search query builder rerenders on auto-refresh#110320
nsdeschenes merged 2 commits intomasterfrom
nd/LOGS-601/fix-tracemetrics-stop-search-query-builder-from-rendering-on-auto-refresh

Conversation

@nsdeschenes
Copy link
Contributor

@nsdeschenes nsdeschenes commented Mar 10, 2026

Summary

  • Extract the logs search/filter area into a memoized LogsSearchSection so table refreshes and layout updates do not force the query builder subtree to rerender.
  • Memoize tracesItemSearchQueryBuilderProps in useLogsSearchQueryBuilderProps so provider props remain referentially stable between auto-refresh cycles.
  • Preserve existing logs search behavior while reducing unnecessary renders that were causing avoidable UI churn.

Refs LOGS-603

Made with Cursor

Extract the logs search and filter UI into a memoized component and memoize query builder
props so auto-refresh and table updates do not re-render the search query builder.

Refs LOGS-601
Co-Authored-By: GPT-5 Codex <noreply@openai.com>

Made-with: Cursor
@github-actions github-actions bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Mar 10, 2026
Move search-only hooks into LogsSearchSection so query-builder props stay scoped to the
search area instead of recomputing with table refresh state. This reduces unnecessary
search bar rerenders while logs data updates.

Made-with: Cursor
@nsdeschenes
Copy link
Contributor Author

@sentry review

@nsdeschenes
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.

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.

{},
'boolean',
HiddenLogSearchFields
);
Copy link
Contributor

Choose a reason for hiding this comment

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

Duplicate attribute hooks double computation in performance PR

Low Severity

useLogItemAttributes is called three times each in both LogsSearchSection and LogsTabContent, totaling six calls. Each call internally runs useTraceItemAttributeConfig, which fetches and computes all three attribute types (string, number, boolean) regardless of the type argument — so the underlying computation runs twice. In a PR focused on reducing unnecessary work during auto-refresh, this duplication is counterproductive. The attributes could be fetched once in LogsTabContent and passed as props to LogsSearchSection, which would also reduce the number of hooks that can trigger re-renders inside the memoized component.

Additional Locations (1)
Fix in Cursor Fix in Web

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Will look into in a follow up.

@nsdeschenes nsdeschenes marked this pull request as ready for review March 10, 2026 18:03
@nsdeschenes nsdeschenes requested a review from a team as a code owner March 10, 2026 18:03
Copy link
Member

@JoshuaKGoldberg JoshuaKGoldberg left a comment

Choose a reason for hiding this comment

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

🆒!

@getsentry getsentry deleted a comment from linear-code bot Mar 11, 2026
@linear-code
Copy link

linear-code bot commented Mar 11, 2026

@nsdeschenes nsdeschenes merged commit 7a8383a into master Mar 11, 2026
74 of 76 checks passed
@nsdeschenes nsdeschenes deleted the nd/LOGS-601/fix-tracemetrics-stop-search-query-builder-from-rendering-on-auto-refresh branch March 11, 2026 13:20
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