Skip to content

Commit

Permalink
fix plugin update with initial state twice (#193)
Browse files Browse the repository at this point in the history
  • Loading branch information
wenxi-zeng authored Oct 26, 2023
1 parent 95c00bf commit ff16c67
Showing 1 changed file with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -71,10 +71,18 @@ internal class Timeline {
plugins[plugin.type]?.add(plugin)
with(analytics) {
analyticsScope.launch(analyticsDispatcher) {
val systemSettings = store.currentState(System::class)?.settings
val systemState = store.currentState(System::class)
val systemSettings = systemState?.settings
systemSettings?.let {
// if we have settings then update plugin with it
plugin.update(it, Plugin.UpdateType.Initial)

if (!systemState.initialSettingsDispatched) {
store.dispatch(
System.ToggleSettingsDispatch(dispatched = true),
System::class
)
}
}
}
}
Expand Down

0 comments on commit ff16c67

Please sign in to comment.