We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
Hello,
I'm trying to create a widget to know the last date of update of a component. For this, I've create a new Widget using the Figma software:
And after, in my VSCode, I've copy the following code based on the https://github.com/figma/widget-samples/blob/main/WidgetDocumentChange/widget-src/code.tsx example.
const { widget } = figma const { useSyncedState, AutoLayout, Text, useEffect } = widget function Widget() { const currentDateDefaultValue = 'XX/XX/XXXX' const [currentDate, setCurrentDate] = useSyncedState('currentDate', currentDateDefaultValue); useEffect(() => { const onDocumentChange = (event: DocumentChangeEvent) => { setCurrentDate('TA/TA/TATA'); }; figma.on('documentchange', onDocumentChange); return () => { figma.off('documentchange', onDocumentChange); } }); return ( <AutoLayout> <Text fontSize={32} italic={true} width={375} horizontalAlignText={'left'}> Updated: {currentDate} </Text> </AutoLayout> ) } widget.register(Widget);
But my onDocumentChange function is never called.
What I miss?
Regards,
The text was updated successfully, but these errors were encountered:
Hey did you figure this out, I'm having the same issue.
Sorry, something went wrong.
This question was answered on the Figma Forms https://forum.figma.com/t/cannot-listen-for-events-in-figjam-widget/35146/5 Basically the widget effect dismounts as soon as it's mounted unless it's waiting for something. We make it wait by using the https://www.figma.com/widget-docs/api/properties/widget-waitfortask/ wait for task function.
No branches or pull requests
Hello,
I'm trying to create a widget to know the last date of update of a component.
For this, I've create a new Widget using the Figma software:
And after, in my VSCode, I've copy the following code based on the https://github.com/figma/widget-samples/blob/main/WidgetDocumentChange/widget-src/code.tsx example.
But my onDocumentChange function is never called.
What I miss?
Regards,
The text was updated successfully, but these errors were encountered: