-
Notifications
You must be signed in to change notification settings - Fork 51
fix: require SDK to update status before emitting events #367
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -172,10 +172,10 @@ See [provider initialization](./02-providers.md#24-initialization), [setting a p | |||||
| ### Event handlers and context reconciliation | ||||||
|
|
||||||
| Providers built to conform to the static context paradigm feature two additional events: `PROVIDER_RECONCILING` and `PROVIDER_CONTEXT_CHANGED`. | ||||||
| When the provider is reconciling its internal state (the `on context changed` function is running and not yet terminated), the SDK emits `PROVIDER_RECONCILING` and transitions the provider into state `RECONCILING`. | ||||||
| When the provider is reconciling its internal state (the `on context changed` function is running and not yet terminated), the SDK transitions the provider into state `RECONCILING` and then emits `PROVIDER_RECONCILING`. | ||||||
| This can be particularly useful for displaying loading indicators while the [evaluation context](./03-evaluation-context.md) is being reconciled. | ||||||
|
|
||||||
| If the `on context changed` function terminates normally, the SDK emits (`PROVIDER_CONTEXT_CHANGED`) and transitions the provider into the `READY` state, otherwise it emits `PROVIDER_ERROR` and transitions the provider into `ERROR` state. | ||||||
| If the `on context changed` function terminates normally, the SDK transitions the provider into the `READY` state and then emits `PROVIDER_CONTEXT_CHANGED`; otherwise it transitions the provider into the `ERROR` state and then emits `PROVIDER_ERROR`. | ||||||
| The `PROVIDER_CONTEXT_CHANGED` is used to signal that the associated context has been changed, and flags should be re-evaluated. | ||||||
| This can be particularly useful for triggering UI repaints in multiple components when one component updates the [evaluation context](./03-evaluation-context.md). | ||||||
|
|
||||||
|
|
@@ -230,7 +230,7 @@ see: [provider event types](../types.md#provider-events), [provider events](#51- | |||||
|
|
||||||
| #### Requirement 5.3.5 | ||||||
|
|
||||||
| > If the provider emits an event, the value of the client's `provider status` **MUST** be updated accordingly. | ||||||
| > If the provider emits an event, the value of the client's `provider status` **MUST** be updated to the status associated with that event **before** the SDK invokes any event handlers for that event, so that handlers observe a consistent status. | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For consistency with the suggested change in
Suggested change
|
||||||
|
|
||||||
| Some providers may emit events spontaneously, based on changes in their internal state (connections, caches, etc). | ||||||
| The SDK must update its internal representation of the provider's state accordingly: | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There's a small typo in the original text that has been removed. The original text was
emits (PROVIDER_CONTEXT_CHANGED)with an extra opening parenthesis. The updated textemitsPROVIDER_CONTEXT_CHANGED`` is correct. This is a good catch!