Skip to content

Commit

Permalink
Merge pull request #42 from dai-shi/notify-on-update
Browse files Browse the repository at this point in the history
support concurrent mode without triggering force update in provider
  • Loading branch information
dai-shi authored Mar 7, 2020
2 parents 4cb598c + c4b5c9f commit 94858d2
Show file tree
Hide file tree
Showing 14 changed files with 218 additions and 144 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
# Change Log

## [Unreleased]
### Changed
- Notify child components in update not in render (#42)
- No updates on props change (breaking change in an undocumented behavior)

## [1.2.0] - 2020-02-29
### Changed
Expand Down
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -164,8 +164,6 @@ You can also try them in codesandbox.io:

## Benchmarks

<img alt="benchmark result" src="https://user-images.githubusercontent.com/490574/62705335-28f34300-ba28-11e9-84ea-8f785c445ff4.png" width="600" />

See [this](https://github.com/dai-shi/react-tracked/issues/1#issuecomment-519509857) for details.

## Blogs
Expand Down
30 changes: 15 additions & 15 deletions __tests__/e2e/__snapshots__/01_minimal.js.snap

Large diffs are not rendered by default.

36 changes: 18 additions & 18 deletions __tests__/e2e/__snapshots__/02_typescript.js.snap

Large diffs are not rendered by default.

18 changes: 9 additions & 9 deletions __tests__/e2e/__snapshots__/03_usestate.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -50,71 +50,71 @@ exports[`03_usestate should work with recorded events 6`] = `
exports[`03_usestate should work with recorded events 7`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 6<div>First Name:<input value=\\"a\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 8<div>First Name:<input value=\\"a\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 26<div>First Name:<input value=\\"a\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 28<div>First Name:<input value=\\"a\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 8`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 10<div>First Name:<input value=\\"aa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 12<div>First Name:<input value=\\"aa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 30<div>First Name:<input value=\\"aa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 32<div>First Name:<input value=\\"aa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 9`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 14<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 16<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 34<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 36<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 10`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 18<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"b\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 20<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"b\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 38<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"b\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 40<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"b\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 11`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 22<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bb\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 24<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bb\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 42<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bb\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 44<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bb\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 12`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 26<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 28<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 46<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"0\\"></div></div><div>numRendered: 48<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"0\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 13`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 30<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"1\\"></div></div><div>numRendered: 32<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"1\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 50<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"1\\"></div></div><div>numRendered: 52<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"1\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 14`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 34<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"11\\"></div></div><div>numRendered: 36<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"11\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 54<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"11\\"></div></div><div>numRendered: 56<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"11\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
`;
exports[`03_usestate should work with recorded events 15`] = `
"
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 38<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"111\\"></div></div><div>numRendered: 40<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"111\\"></div></div></div>
<div id=\\"app\\"><h1>Counter</h1><div>numRendered: 22<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><div>numRendered: 24<div><span>Count: 5</span><button type=\\"button\\">+1</button></div></div><h1>Person</h1><div>numRendered: 58<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"111\\"></div></div><div>numRendered: 60<div>First Name:<input value=\\"aaa\\"></div><div>Last Name:<input value=\\"bbb\\"></div><div>Age:<input value=\\"111\\"></div></div></div>
<script type=\\"text/javascript\\" src=\\"main.js\\"></script>
"
Expand Down
Loading

0 comments on commit 94858d2

Please sign in to comment.