mirror of
https://github.com/zebrajr/react.git
synced 2026-01-15 12:15:22 +00:00
I'm in the process of codemodding our test suite to the waitFor pattern. See #26285 for full context. This module required a lot of manual changes so I'm doing it as its own PR. The reason is that most of the tests involved simulating an async import by wrapping them in `Promise.resolve()`, which means they would immediately resolve the next time the microtask queue was flushed. I rewrote the tests to resolve the simulated import explicitly. While converting these tests, I also realized that the `waitFor` helpers weren't properly waiting for the entire microtask queue to recursively finish — if a microtask schedules another microtask, the subsequent one wouldn't fire until after `waitFor` had resolved. To fix this, I used the same strategy as `act` — wait for a real task to finish before proceeding, such as a message event.
react-cache
A basic cache for React applications. It also serves as a reference for more advanced caching implementations.
This package is meant to be used alongside yet-to-be-released, experimental React features. It's unlikely to be useful in any other context.
Do not use in a real application. We're publishing this early for demonstration purposes.
Use it at your own risk.
No, Really, It Is Unstable
The API may will change wildly between versions.