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
Problem
When using the gosling ref to subscribe to events of the API in a component wrapping the GoslingComponent, events published during compiling are not captured.
Expected behavior
{specProcessed, object} is logged
Explanation:
The useRef hook works by assigning the ref to a DOM node. This happens when the component is rendered, e.g. assigned to the root. Thus, the UseEffect hook (with the ref in it's dependency array) is called after the first render.
With Gosling the compiling happens before the component is rendered. Therefore, the events are already published before the ref is assigned (the subscribe function is called too late).
Possible solution?
An initial render of an empty canvas, assigning the DOM node and then updating the component after it has compiled.
The text was updated successfully, but these errors were encountered:
Problem
When using the gosling ref to subscribe to events of the API in a component wrapping the GoslingComponent, events published during compiling are not captured.
Minimal example
Minimal example using the same UseEffect as in the editor
Observed behavior
Nothing is logged
Expected behavior
{specProcessed, object} is logged
Explanation:
The useRef hook works by assigning the ref to a DOM node. This happens when the component is rendered, e.g. assigned to the root. Thus, the UseEffect hook (with the ref in it's dependency array) is called after the first render.
With Gosling the compiling happens before the component is rendered. Therefore, the events are already published before the ref is assigned (the subscribe function is called too late).
Possible solution?
An initial render of an empty canvas, assigning the DOM node and then updating the component after it has compiled.
The text was updated successfully, but these errors were encountered: