widgetSyncedState always returning empty object

Hi! I’m trying to read the synced state of a widget using a plugin by using widgetSyncedState from the Plugin API. For some reason it’s always returning an empty object?

I know the widget state is not empty because I’ve been setting it with useSyncedState and can see the changes in the widget. But when I try to read the state using the API or even look at the widgetSyncedState property in the console, it’s empty. Am I missing something here? Any help would be appreciated!

widgetSyncedState: { [key: string]: any } [readonly]
Returns the synced state stored on the widget. This is only readable by widgets created by the same manifest.id.

So does that mean it’s not possible to have a plugin read a widget’s state? Are there any workarounds if I want to have a plugin read data from a widget?

If your plugin’s manifest.id is not the same as the widget’s, then yes, that’s right.

Set and get data from the WidgetNode using setSharedPluginData and getSharedPluginData respectively.

I see, thanks so much!

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.