-
Notifications
You must be signed in to change notification settings - Fork 1
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: added context in item-template #886
base: main
Are you sure you want to change the base?
Conversation
🦋 Changeset detectedLatest commit: dd58363 The changes in this PR will be included in the next version bump. This PR includes changesets to release 4 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
Visit the preview URL for this PR (updated for commit dd58363): https://react-kitchen-sink-dev--pr886-885-context-in-item-4y5vbs4w.web.app (expires Thu, 21 Nov 2024 07:04:11 GMT) 🔥 via Firebase Hosting GitHub Action 🌎 Sign: 6267897ade2ba783b6db70a53a60fc3946d625e9 |
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.
Please write a test suite to avoid regressions
template: CollapsibleItem; | ||
setEvaluated: React.Dispatch<React.SetStateAction<CollapsibleTemplate[]>>; | ||
}): null => { | ||
const evaluatedData = useEvaluate({ ...template }, { context }); |
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.
This should only evaluate the key, otherwise you will create additional bindings for label and children attributes you don't need.
prevEvaluated[currentIndex] = { key, label: header, children: content }; | ||
return prevEvaluated; | ||
}); | ||
}, [currentIndex, evaluatedData, setEvaluated]); |
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.
This should only check for the key.
]); | ||
|
||
setEvaluated((prev) => { | ||
const prevEvaluated = [...prev]; |
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.
Why duplicate the array?
: EnsembleRuntime.render([unwrapWidget(label)]); | ||
|
||
const content = EnsembleRuntime.render([ | ||
unwrapWidget(children as string), |
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.
The children and label are the same across all the items right? This can be unwrapped once and passed in.
Describe your changes
Added context in item-template of collapsible widget
Screenshots [Optional]
After
Issue ticket number and link
Closes #885
Checklist before requesting a review
pnpm changeset add