Skip to content
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

fix(progress-steps): unnecessary re-renders #4170

Merged
merged 1 commit into from
Nov 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions .changeset/nervous-rabbits-love.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
"@twilio-paste/progress-steps": patch
"@twilio-paste/core": patch
---

[ProgressSteps] fixed an issue where progress steps was rerendering unnecessarily
7 changes: 7 additions & 0 deletions internal-docs/engineering/gotchas.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# Gotchas

The purpose of this document is to keep a list of niche issues that have arisen over the lifetime of the product that we do not want to re-introduce. This can be related to our coded or third party libraries.

## Emotion Library

* If you pass a prop of the component into `styled.div` be sure to wrap it in useMemo as this librabry causes unnecessary re-renders otherwise.
Original file line number Diff line number Diff line change
Expand Up @@ -89,11 +89,15 @@ const ItemSeparatorStyles: {

export const ProgressSteps = React.forwardRef<HTMLDivElement, ProgressStepsProps>(
({ element = "PROGRESS_STEPS", orientation = "horizontal", ...props }, ref) => {
const ContainerStyled = styled.div(
css({
display: "flex",
...ItemSeparatorStyles[orientation],
}),
const ContainerStyled = React.useMemo(
() =>
styled.div(
css({
display: "flex",
...ItemSeparatorStyles[orientation],
}),
),
[orientation],
);

return (
Expand Down
Loading