Working with Widgets
In order to ensure predictable and performant Widgets, here’s a list of things to keep in mind as you’re building them:
- A widget’s render function should depend only on values returned by
useSyncedState
ORuseSyncedMap
. - Widgets appear the exact same to all users.
- The only way to update a widget is by updating its state, which will re-render the widget automatically.
- Many widgets can be in a file, but a user is only allowed to run one widget at a time.
- Widget code can be terminated at any time by the user / FigJam. Known events that would terminate widget code are:
- a user leaves/closes the file
- a user explicitly stops a long running widget via the visual bell
- a user deletes the running widget
- a user explicitly interacts with another widget in the file