Skip to content

Commit ff16c67

Browse files
authored
fix plugin update with initial state twice (#193)
1 parent 95c00bf commit ff16c67

File tree

1 file changed

+9
-1
lines changed
  • core/src/main/java/com/segment/analytics/kotlin/core/platform

1 file changed

+9
-1
lines changed

core/src/main/java/com/segment/analytics/kotlin/core/platform/Timeline.kt

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -71,10 +71,18 @@ internal class Timeline {
7171
plugins[plugin.type]?.add(plugin)
7272
with(analytics) {
7373
analyticsScope.launch(analyticsDispatcher) {
74-
val systemSettings = store.currentState(System::class)?.settings
74+
val systemState = store.currentState(System::class)
75+
val systemSettings = systemState?.settings
7576
systemSettings?.let {
7677
// if we have settings then update plugin with it
7778
plugin.update(it, Plugin.UpdateType.Initial)
79+
80+
if (!systemState.initialSettingsDispatched) {
81+
store.dispatch(
82+
System.ToggleSettingsDispatch(dispatched = true),
83+
System::class
84+
)
85+
}
7886
}
7987
}
8088
}

0 commit comments

Comments
 (0)