-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix[gen1][react]: ENG-8739 change to makeFn() for handling errors when serialising functions #4050
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
base: main
Are you sure you want to change the base?
Conversation
|
View your CI Pipeline Execution ↗ for commit e488305.
☁️ Nx Cloud last updated this comment at |
|
GitGuardian id | GitGuardian status | Secret | Commit | Filename | |
---|---|---|---|---|---|
11707119 | Triggered | Generic High Entropy Secret | e488305 | packages/sdks/snippets/react-sdk-next-14-app/app/(blueprints-product-details)/home/page.tsx | View secret |
🛠 Guidelines to remediate hardcoded secrets
- Understand the implications of revoking this secret by investigating where it is used in your code.
- Replace and store your secret safely. Learn here the best practices.
- Revoke and rotate this secret.
- If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.
To avoid such incidents in the future consider
- following these best practices for managing and storing secrets including API keys and other credentials
- install secret detection on pre-commit to catch secret before it leaves your machine and ease remediation.
🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.
try { | ||
return JSON.parse(stringify(val)); | ||
} catch (e) { | ||
log('Error:', e); | ||
return refToProxy(val); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i will let @teleaziz or @samijaber review this PR. I am not fully grasping this change, I am thinking if instead of a try catch we should handle passing of functions correctly. I can see that here we return the value itself if the obj is not an object:
builder/packages/react/src/functions/string-to-function.ts
Lines 202 to 204 in 804a458
if (typeof obj !== 'object' || obj === null) { | |
return obj; | |
} |
and I am guessing that's fixing this issue because we're re-calling it to handle this? and I can see some error logs that you're printing in the server in your loom that fn couldn't get parsed.
What if we check if the value (const val = obj.getSync(key);
) is not an object then just return it without parsing it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, but its missing a changeset
Description
Changed makeFn() for handling errors when serialising functions
JIRA Ticket
https://builder-io.atlassian.net/browse/ENG-8739
PR that caused the hydration error
#3396
Steps to reproduce
See this comment - https://builder-io.atlassian.net/browse/ENG-8739?focusedCommentId=28667
Loom
https://www.loom.com/share/8b961a80726d4fe4ad8bdf52e389f72a
Screenshot
Code coverage
