Skip to content

Fix ObservableStore.updateState and constructor type bugs#38

Merged
rekmarks merged 1 commit intomainfrom
fix-update-state-type
Feb 6, 2021
Merged

Fix ObservableStore.updateState and constructor type bugs#38
rekmarks merged 1 commit intomainfrom
fix-update-state-type

Conversation

@rekmarks
Copy link
Copy Markdown
Member

@rekmarks rekmarks commented Feb 6, 2021

Fixes:

  • Constructor was typed to allow no default state
    • We preserve a default state initialization under the hood to preserve backwards incompatibility for JavaScript consumers
  • updateState must accept a Partial<T> where T is its generic type

@rekmarks rekmarks requested a review from a team as a code owner February 6, 2021 07:27
@rekmarks rekmarks merged commit 673d72f into main Feb 6, 2021
@rekmarks rekmarks deleted the fix-update-state-type branch February 6, 2021 07:28
Gudahtt added a commit that referenced this pull request Apr 3, 2023
This library has used an empty object as the default initial state ever
since the initial version, but in older versions that was only set if
the initial state was undefined. An initial state of `null` or any
other falsy value other than `undefined`  was still accepted.

In #38 (published as part of v6.0.2) this was accidentally changed.
Instead the empty object default was used for any falsy value passed in
as the initial state.

The pre-v6.0.2 behavior has now been restored; falsy initial state is
no longer overwritten.
@Gudahtt Gudahtt mentioned this pull request Apr 3, 2023
Gudahtt added a commit that referenced this pull request Apr 3, 2023
This library has used an empty object as the default initial state ever
since the initial version, but in older versions that was only set if
the initial state was undefined. An initial state of `null` or any
other falsy value other than `undefined`  was still accepted.

In #38 (published as part of v6.0.2) this was accidentally changed.
Instead the empty object default was used for any falsy value passed in
as the initial state.

The pre-v6.0.2 behavior has now been restored; falsy initial state is
no longer overwritten.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant