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

nodeOps.createElement throws when props === null #827

Closed
5 tasks done
andretchen0 opened this issue Sep 7, 2024 · 0 comments · Fixed by #829
Closed
5 tasks done

nodeOps.createElement throws when props === null #827

andretchen0 opened this issue Sep 7, 2024 · 0 comments · Fixed by #829

Comments

@andretchen0
Copy link
Contributor

andretchen0 commented Sep 7, 2024

Problem

As of PR (80f8a2e), some playgrounds are broken. And user code is likely also broken.

Broken playground example:

http://localhost:5173/events/dynamic-objects

Error:

Uncaught (in promise) TypeError: props is null
    createElement nodeOps.ts:34

Here's the problem line in src/nodeOps.ts:

  function createElement(tag: string, _isSVG: undefined, _anchor: any, props: Partial<WithMathProps<TresObject>> = {}): TresObject | null {

The signature was changed from the signature in the Vue docs:

  createElement(
    type: string,
    isSVG?: boolean,
    isCustomizedBuiltIn?: string,
    vnodeProps?: (VNodeProps & { [key: string]: any }) | null
  ): HostElement

The new signature isn't equivalent. The docs' version says Vue can pass null for props.

But if nodeOps.createElement gets an explicit null, it throws on the next line when checking if (!props.args).

Solution

Revert the signature and readd the check for null props.

Reproduction

N/A - see above

Steps to reproduce

System Info

N/A

Used Package Manager

npm

Code of Conduct

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant