Skip to content

Conversation

@jihea-park
Copy link
Contributor

No description provided.

Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

This pull request applies memoization to the UrlSummaryFetcher component to optimize the creation of table columns. The change wraps the summaryColumns call with React.useMemo to prevent unnecessary recalculation of column definitions on every render.

Changes:

  • Wrapped the summaryColumns call with React.useMemo to memoize column definitions based on orderBy and isDesc dependencies

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines 26 to 41
const columns = React.useMemo(
() =>
summaryColumns({
orderBy,
isDesc,
onClickColumnHeader: (key) => {
if (orderBy === key) {
setIsDesc(!isDesc);
} else {
setIsDesc(true);
}

setOrderBy(key);
},
});
setOrderBy(key);
},
}),
[orderBy, isDesc],
);
Copy link

Copilot AI Jan 19, 2026

Choose a reason for hiding this comment

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

The memoization implementation has a stale closure issue. The callback function onClickColumnHeader references isDesc in the expression setIsDesc(!isDesc) on line 33, but the memoization only depends on [orderBy, isDesc]. When the callback is invoked after the memoization has been skipped, it will use a stale value of isDesc. To fix this, use the functional update form: setIsDesc((prev) => !prev) instead of setIsDesc(!isDesc). This ensures the callback always operates on the current state value without requiring isDesc in the closure.

Copilot uses AI. Check for mistakes.
@codecov
Copy link

codecov bot commented Jan 19, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 33.18%. Comparing base (dbfbbc7) to head (00c3e3f).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@             Coverage Diff              @@
##             master   #13303      +/-   ##
============================================
- Coverage     33.18%   33.18%   -0.01%     
+ Complexity    10975    10973       -2     
============================================
  Files          4070     4070              
  Lines         94432    94432              
  Branches       9830     9830              
============================================
- Hits          31340    31338       -2     
  Misses        60420    60420              
- Partials       2672     2674       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@jihea-park jihea-park merged commit d295edd into pinpoint-apm:master Jan 19, 2026
5 checks passed
@jihea-park jihea-park deleted the urlSummaryColumMemo branch January 19, 2026 02:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant