Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

1.21.0 - React 17, cache break and batch()

Latest
Compare
Choose a tag to compare
Loading
@lostpebblelostpebble released this 07 Mar 12:58
· 18 commits to master since this release

Added in abatch() function which allows you to run multipleStore.update() inside of it, and have all the updates be batched at the same time to your App. Updates inbatch() must be synchronous (can't be an async function). This allows defining cross-store updates in a more performant way, when these changes are made outside of the React event structures (regular button clicks etc.- these are batched by React by default).

Async Actions now also accept an extra option when being consumed:

const getImagesAction = GetImages.use({ tag: "green" }, { cacheBreak: true });

cacheBreak can be a boolean or a function which returns a boolean value (the function signature is the same as the regularcacheBreakHook that you can set when creating Async Actions).

This allows you to more finely control the cache breaking per a component- the next time a component is mounted, it will check this value and decide if we need to run the action anew.

This can also go hand-in-hand with another option:holdPrevious: true - which will hold the previously result of the Async Action (if its available) while the action runs again on the cache break.


Pullstate now also defines that it supports the peer dependency ofreact for versions^17.0.0 as well- this prevents NPM errors in the newer version, which is more strict about peer dependencies.

Assets2
Loading

[8]ページ先頭

©2009-2025 Movatter.jp