Skip to content
Discussion options

You must be logged in to vote

I ended up with code like:

const channel = addons.getChannel();

const themeName = channel.last('updateGlobals')?.at(0)?.globals?.theme ?? 'default';

Subscribing to channel.on('updateGlobals', handler) inside useEffect didn't work, because component rerenders from scratch after globals change.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by vpanfilov
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Help
Labels
None yet
1 participant