You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I ran into this strange issue while refactoring test scenes, where type checking via PropUtils is not working in dev mode if there are only few routes (one-two links to scenes as a part of a side navigation) pointing to sveltehree-scenes. E.g. with:
If there are more routes, everything is ok in dev mode.
Also, with a built project, everything is ok in preview mode.
I'm not sure why this is happening, I guess it has something to do with the SvelteKit router / hmr in dev mode.
Changing the above to p?.constructor.name === "Vector3" works as a ducktape-fix.
After finding out what's going on, I've realized that I could generally improve type checking in PropUtils a bit by:
- ducktape-fix
- use `Array.isArray() `
- refactor / add new methods to avoid redundant Array tcpe checks
- removed `isPropType` method since it's not being used anywhere.
I ran into this strange issue while refactoring test scenes, where type checking via
PropUtils
is not working in dev mode if there are only few routes (one-two links to scenes as a part of a side navigation) pointing to sveltehree-scenes. E.g. with:svelthree/src/utils/PropUtils.ts
Lines 56 to 58 in 754a5f1
p?.constructor === Vector3
would befalse
.If there are more routes, everything is ok in dev mode.
Also, with a built project, everything is ok in preview mode.
I'm not sure why this is happening, I guess it has something to do with the SvelteKit router / hmr in dev mode.
Changing the above to
p?.constructor.name === "Vector3"
works as a ducktape-fix.After finding out what's going on, I've realized that I could generally improve type checking in
PropUtils
a bit by:Array.isArray()
which seems to be the fastest method for Array type checking (see https://www.measurethat.net/Benchmarks/Show/2872/0/isarray#latest_results_block).is*
propertiesThe text was updated successfully, but these errors were encountered: