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(princing-page): fix hydratation #163

Merged
merged 1 commit into from
Jun 12, 2024
Merged

fix(princing-page): fix hydratation #163

merged 1 commit into from
Jun 12, 2024

Conversation

jsfez
Copy link
Collaborator

@jsfez jsfez commented Jun 2, 2024

No description provided.

@jsfez jsfez requested a review from gregberge June 2, 2024 13:57
Copy link
Member

@gregberge gregberge left a comment

Choose a reason for hiding this comment

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

For percent formatter too please. You should make the hook generic to pass any formatter maybe?

Copy link

argos-ci bot commented Jun 2, 2024

The latest updates on your projects. Learn more about Argos notifications ↗︎

Build Status Details Updated (UTC)
default (Inspect) 👍 Changes approved 8 changed Jun 11, 2024, 9:46 AM

app/pricing/formatters.ts Outdated Show resolved Hide resolved
app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
);

React.useEffect(() => {
setFormatter(new Intl.NumberFormat(undefined, optionsRef.current));
Copy link
Member

Choose a reason for hiding this comment

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

It would be much more efficient to store value in state because if locale produces the same it will avoid a re-render.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't understand how to do that and I don't want to delay the PR. As the efficiency improvement has no value here, I'll ignore it.

app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
);

React.useEffect(() => {
setFormatter(() => new Intl.NumberFormat(undefined, optionsRef.current));
Copy link
Member

Choose a reason for hiding this comment

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

As I said it's inneficient to set the formatter and not the value.

Copy link
Collaborator Author

@jsfez jsfez Jun 11, 2024

Choose a reason for hiding this comment

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

  • Greg: inefficient
  • Jeremy: NIT (nitpicking)
  • Greg: inefficient

Well, well 🐳

app/pricing/FormattersComponents.tsx Outdated Show resolved Hide resolved
@gregberge gregberge merged commit b8be683 into main Jun 12, 2024
3 checks passed
@gregberge gregberge deleted the rework-princing-page branch June 12, 2024 06: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.

2 participants