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: prevent rendering too many hooks error #8667

Merged
merged 3 commits into from
Nov 6, 2024
Merged

Conversation

thomasheartman
Copy link
Contributor

@thomasheartman thomasheartman commented Nov 6, 2024

We found an issue where we'd get a minified react error referencing the LazyProjectExport component.

image

We suspect that the issue might be the conditional rendering of this component, so the fix is to always render it, but to use the flag to check whether we should show the count or not.

Copy link

vercel bot commented Nov 6, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
unleash-monorepo-frontend ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 6, 2024 11:37am
1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
unleash-docs ⬜️ Ignored (Inspect) Visit Preview Nov 6, 2024 11:37am

Copy link
Contributor

github-actions bot commented Nov 6, 2024

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

OpenSSF Scorecard

PackageVersionScoreDetails

Scanned Files

const projectId = useRequiredPathParam('projectId');
const { total } = useActionableChangeRequests(projectId);

const count = simplifyProjectOverview ? 0 : (total ?? 0);
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't if (!simplifyProjectOverview) return null; a better check? If the flag is off we don't add empty elements to the DOM.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No, because if we return null, we won't render a label at all. This way, at least the label is the same, though we could potentially just use a different label

Copy link
Contributor

Choose a reason for hiding this comment

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

Ok, I thought this was just the count. I'll go ahead and approve it then.

Copy link
Contributor Author

@thomasheartman thomasheartman Nov 6, 2024

Choose a reason for hiding this comment

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

But I found a nicer way to do it in ad7aa87. We'll just render the text. This makes it render exactly the same as all the other tabs do.

Copy link
Contributor

@FredrikOseberg FredrikOseberg left a comment

Choose a reason for hiding this comment

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

LGTM

@thomasheartman thomasheartman merged commit 3d10887 into main Nov 6, 2024
5 of 7 checks passed
@thomasheartman thomasheartman deleted the fix/rendering-issue branch November 6, 2024 11:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

2 participants