bluefishjs / bluefish-archive

A SolidJS diagramming framework
https://bluefishjs.org
MIT License
75 stars 4 forks source link

SolidJS `children` function causes internal scenegraph error. #60

Closed vezwork closed 8 months ago

vezwork commented 8 months ago

I get the following error when I define a component and tried to calculate the width of a Rect in that component using the length of props.children.

Error useError must be used within an ErrorContext.Provider

Here is a link to codesandbox with the error: https://codesandbox.io/p/sandbox/bluefish-qc-text-forked-tg7lk9?file=/App.js.

The the relevent code is:

const Wire = withBluefish((props) => {
  const c = children(() => props.children);
  return (
    // ...
    <Rect height={3} width={(c().length ?? 1) * 60 + 30} fill="black"></Rect>
  // ...

As a result of this error, I cannot use the length of props.children in a calculation.

joshpoll commented 8 months ago

Marking this as won't fix for the time being, since I'm not sure how to resolve props.children outside its correct parent context.