is it possible to have multiple instances of the s...
# glance
b
is it possible to have multiple instances of the same Glance widget? I'm not seeing any documentation around state definition and worker communication/interaction when dealing with more than one instance
w
Yes, having mutiple instances of the same Glance widget should work fine. They will have unique app widget IDs and separate workers. GlanceStateDefinition should also continue to work with multiple widgets. The
fileKey
param for
getDataStore
is unique per-widget, so there will be separate DataStore for each widget as before
b
My usecase is separate data showing in each widget based on a selected entity during configuration (e.g select organization, show data for that org)
m
Check the source code of PreferenceGlanceStateDefinition. It does what Willie is saying. That being said in the upcoming changes with recomposition support the state definition won’t be needed anymore. You can use the Glance ID to setup different configurations