From f689d36d45d8ab9f43519723d21d781d827c4122 Mon Sep 17 00:00:00 2001 From: Laurent Raymond <1528484+Dvergar@users.noreply.github.com> Date: Tue, 10 Oct 2023 09:54:30 +0200 Subject: [PATCH 1/2] [Fix] Note on eventual consistency --- packages/sdk/src/controllers/SubscriberController.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/packages/sdk/src/controllers/SubscriberController.ts b/packages/sdk/src/controllers/SubscriberController.ts index a3f174c1..2992f913 100644 --- a/packages/sdk/src/controllers/SubscriberController.ts +++ b/packages/sdk/src/controllers/SubscriberController.ts @@ -303,6 +303,12 @@ export class SubscriberController { * * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error * @param connectorEvent Stringified object of ConnectorEvent + * + * **Eventual Consistency** + * + * Because of the nature of an async stream, be aware that some behaviors such + * as undo & redo might create scenarios where you're reacting on an event tied + * to a connector that has an old state. */ onConnectorEvent = (connectorEvent: string) => { const callBack = this.config.onConnectorEvent; From a999f8a24b262a476bf0c851ca80ddcbb0e844d1 Mon Sep 17 00:00:00 2001 From: Laurent Raymond <1528484+Dvergar@users.noreply.github.com> Date: Wed, 26 Jun 2024 09:56:47 +0200 Subject: [PATCH 2/2] [Fix] Moved note to readme --- packages/sdk/src/README.md | 7 +++++++ packages/sdk/src/README_HTML.md | 7 +++++++ packages/sdk/src/controllers/SubscriberController.ts | 6 ------ 3 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/sdk/src/README.md b/packages/sdk/src/README.md index d85e641d..f93fde4a 100644 --- a/packages/sdk/src/README.md +++ b/packages/sdk/src/README.md @@ -36,3 +36,10 @@ You can find the entire definition [on this page](interfaces/types_DocumentTypes ## Enums, Types, Interfaces and general Methods If you want to check out some types, interfaces and general methods, you can find them all bundled [under the modules page](modules). + +## Eventual Consistency + +Because of the nature of an async stream, be aware that you may react on an item that has an old state. +Eventual consistency means that you will _eventually_ get the correct state from the stream. + +See: https://en.wikipedia.org/wiki/Eventual_consistency diff --git a/packages/sdk/src/README_HTML.md b/packages/sdk/src/README_HTML.md index f2b27de2..de6f9178 100644 --- a/packages/sdk/src/README_HTML.md +++ b/packages/sdk/src/README_HTML.md @@ -35,3 +35,10 @@ You can find the entire definition [on this page](interfaces/types_DocumentTypes ## Enums, Types, Interfaces and general Methods If you want to check out some types, interfaces and general methods, you can find them all bundled [under the modules page](modules). + +## Eventual Consistency + +Because of the nature of an async stream, be aware that you may react on an item that has an old state. +Eventual consistency means that you will _eventually_ get the correct state from the stream. + +See: https://en.wikipedia.org/wiki/Eventual_consistency diff --git a/packages/sdk/src/controllers/SubscriberController.ts b/packages/sdk/src/controllers/SubscriberController.ts index 2992f913..a3f174c1 100644 --- a/packages/sdk/src/controllers/SubscriberController.ts +++ b/packages/sdk/src/controllers/SubscriberController.ts @@ -303,12 +303,6 @@ export class SubscriberController { * * stateChanged - this event will be triggered by connector states: loading, loaded, running, ready, error * @param connectorEvent Stringified object of ConnectorEvent - * - * **Eventual Consistency** - * - * Because of the nature of an async stream, be aware that some behaviors such - * as undo & redo might create scenarios where you're reacting on an event tied - * to a connector that has an old state. */ onConnectorEvent = (connectorEvent: string) => { const callBack = this.config.onConnectorEvent;