-
-
Notifications
You must be signed in to change notification settings - Fork 109
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
primitive obj
reactivity broken after nodeOps being a function
#600
Comments
Maybe @andretchen0 can you give me a hand with this one? The problem is here Lines 197 to 199 in 8efe6e0
v4
I was trying to avoid needing to duplicate the code inside of createElement, but now that Let me know |
Sure thing. I'll have a look! |
Hey @alvarosabu ! FixOne approach to this would be to define the functions and then collect them into an object to return. Concretely, right now nodeOps looks like ... export const nodeOps: () => RendererOptions<TresObject, TresObject | null> = () => {
let scene: TresScene | null = null
// NOTE: functions are defined in the return object
return { createElement(tag, _isSVG, _anchor, props): TresObject | null {
if (!props) props = {}
if (!props.args) {
props.args = []
} But if it's like the following, then you can call export const nodeOps: () => RendererOptions<TresObject, TresObject | null> = () => {
let scene: TresScene | null = null
// NOTE: createElement, etc. are still defined within the nodeOps function, so they close over scene
const createElement(tag, _isSVG, _anchor, props): TresObject | null => { ... }
const patchProp(node, prop, prevValue, nextValue) => { ...
...
// NOTE: patchProp now closes over createElement, so you can call it like so ...
const newInstance = createElement('primitive', undefined, undefined, { ...
...
}
// NOTE: assemble the `RendererOptions` object and return it.
return {
createElement,
patchProp,
...
}
} QuestionWould you like me to submit a PR? |
Thanks @andretchen0 you are completely right, I just created the PR #602 |
Describe the bug
Seems like making
nodeOps
a function #579 broke primitiveobj
reactivity since we need to create a new element forprimitive
Reproduction
local
Steps to reproduce
No response
System Info
Used Package Manager
pnpm
Code of Conduct
The text was updated successfully, but these errors were encountered: