This repository has been archived by the owner on Dec 31, 2020. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Schedule uncommitted reaction cleanup (#121) * Test cleaning up reactions for uncommitted components * First attempt at a fix for cleaning up reactions from uncommitted components * Use debounce instead of fixed interval * Add unit test for missing observable changes before useEffect runs This is a test to check that observable changes made between the first component render and commit are not lost. It currently fails (and did so before the change in PR #119) * Add test for cleanup timer firing too early for some components This demonstrates (in a slightly contrived way) how, if the cleanup timer fires between a recent component being rendered and it being committed, that it would incorrectly tidy up a reaction for a soon-to-be-committed component. * Update test for missing changes to check Strict and non-Strict mode We had an existing test to check that observable changes between render and commit didn't go missing, but it only checked in Strict mode, and there's a problem with non-Strict mode. * Add cleanup tracking and more tests This adds full cleanup tracking, and even more tests: - we now track how long ago potentially leaked reactions were created, and only clean those that were leaked 'a while ago' - if a reaction is incorrectly disposed because a component went away for a very long time and came back again later (in a way React doesn't even do right now), we safely recreate it and re-render - trap the situation where a change is made to a tracked observable between first render and commit (where we couldn't force an update because we hadn't _been_ committed) and force a re-render - more unit tests * Fix renamed test file When I renamed this file, I forgot the .test. suffix. D'oh. * Extract tracking and cleanup logic out to separate file * Update src/useObserver.ts Co-Authored-By: RoystonS <[email protected]> * Move some more tracking internals into the tracking code * 2.0.0-alpha.0 * 2.0.0-alpha.1 * 2.0.0-alpha.2 * Upgrade to React 16.9 * Add dedup script and run it * Remove deprecated hooks * Increase size limit * Remove note about Next version * Remove unused productionMode util * Improve readme * Pin dependencies * Merge master properly * Ignore build cache files * Revert removal of tsdx dep * Remove .browserlistrc * 2.0.0-alpha.3 * Bundling need to use build tsconfig * 2.0.0-alpha.4 * Remove object destructuring from optimizeForReactDOM/Native (#240) * Preserve generics when using `observer` (#244) * Preserve generics when using `observer` * Remove any casting from statics as it's no longer needed * Re-add overloads for explicitly specifying props type * Allow for passing options without `forwardRef` * Merge new `observer` overloads * Remove copy of UMD bundle * 2.0.0-alpha.5 * Batched updates are mandatory * Replace .npmignore with files field * Fix tests * Increase size limit Co-authored-by: Royston Shufflebotham <[email protected]> Co-authored-by: Renovate Bot <[email protected]> Co-authored-by: Tarvo R <[email protected]> Co-authored-by: Lukáš Novotný <[email protected]>
- Loading branch information
1 parent
d638b07
commit ef91cca
Showing
28 changed files
with
862 additions
and
768 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
require("./dist").observerBatchingOptOut() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
// should be to be in each test file to load typings properly | ||
require("@testing-library/jest-dom/extend-expect") | ||
|
||
global.__DEV__ = false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
declare const __DEV__: boolean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,10 @@ | ||
import "./assertEnvironment" | ||
|
||
export { useObservable } from "./useObservable" | ||
export { useComputed } from "./useComputed" | ||
export { useDisposable } from "./useDisposable" | ||
export { isUsingStaticRendering, useStaticRendering } from "./staticRendering" | ||
export { observer, IObserverOptions } from "./observer" | ||
export { useObserver, ForceUpdateHook, IUseObserverOptions } from "./useObserver" | ||
export { Observer } from "./ObserverComponent" | ||
export { useForceUpdate } from "./utils" | ||
export { useAsObservableSource } from "./useAsObservableSource" | ||
export { useLocalStore } from "./useLocalStore" | ||
export { optimizeScheduler } from "./optimizeScheduler" | ||
export { observerBatching, observerBatchingOptOut, isObserverBatched } from "./observerBatching" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.