Skip to content

Send patches to state subscribers #363

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

Merged
merged 1 commit into from
Feb 24, 2021
Merged

Conversation

Gudahtt
Copy link
Member

@Gudahtt Gudahtt commented Feb 23, 2021

Subscribers of the new BaseController will now also receive a patch for each state change, in addition to a copy of the new state. Patches can make it easier to efficiently serialize state updates.

This was done as part of the controller redesign (#337).

Subscribers of the new BaseController will now also receive a patch for
each state change, in addition to a copy of the new state. Patches can
make it easier to efficiently serialize state updates.

This was done as part of the controller redesign (#337).
@Gudahtt Gudahtt marked this pull request as ready for review February 23, 2021 19:19
@Gudahtt Gudahtt requested a review from a team as a code owner February 23, 2021 19:19
const nextState = produce(this.internalState, callback) as S;
this.internalState = nextState;
const [nextState, patches] = produceWithPatches(this.internalState, callback);
this.internalState = nextState as S;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice if this as S could be omitted, but when I leave it out I get an error I don't understand 🤔

Copy link
Member

@rekmarks rekmarks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@Gudahtt Gudahtt merged commit 6e0b2da into develop Feb 24, 2021
@Gudahtt Gudahtt deleted the send-patches-to-subscribers branch February 24, 2021 04:43
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
Subscribers of the new BaseController will now also receive a patch for
each state change, in addition to a copy of the new state. Patches can
make it easier to efficiently serialize state updates.

This was done as part of the controller redesign (#337).
MajorLift pushed a commit that referenced this pull request Oct 11, 2023
Subscribers of the new BaseController will now also receive a patch for
each state change, in addition to a copy of the new state. Patches can
make it easier to efficiently serialize state updates.

This was done as part of the controller redesign (#337).
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.

2 participants