-
Notifications
You must be signed in to change notification settings - Fork 140
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
refactor: props, states and contexts view #166
base: main
Are you sure you want to change the base?
Conversation
@pivanov is attempting to deploy a commit to the Million Team on Vercel. A member of the Team first needs to authorize it. |
commit: |
const contextObj: Record<string, unknown> = {}; | ||
|
||
contexts.forEach((value, contextName) => { | ||
contextObj[contextName] = value.displayValue; |
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.
Take note: in the future we might want to change this implementation, as this is a megamorphic code (hurts perf)
whatChangedSection: createHTMLTemplate<HTMLDetailsElement>( | ||
`<details class="react-scan-what-changed" style="background-color:#b8860b;color:#ffff00;padding:5px"> | ||
<summary class="font-bold">What changed?</summary> | ||
</details>`, |
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.
quotes and closing tags are optional, but this is fine. Although new lines and tabs/spaces, definitely we want to shave off.
|
||
const currentContext = getCurrentContext(fiber); | ||
if (Object.keys(currentContext).length) { | ||
tryOrElse(() => { |
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.
in the future, it should be of preference that we should use try-catch
directly instead of using utilities like this (for 2 reasons: JS compilers cannot optimize this + closures are painful to optimize with). The utility itself has some ideal uses, but not in this case, I guess. Don't worry, I'll fix this one.
props-states-context.mov