Commit Graph
10419 Commits
Author SHA1 Message Date
Sophie AlpertandAndrew Clark 3a7c6da8d4 Make effects actually work with memo
Bug fix.
2018-10-29 11:26:54 -07:00
Sophie AlpertandAndrew Clark 75a1c2e72a The Lost Effect, chapter 3
wow, writing code is hard
2018-10-29 11:26:54 -07:00
Sophie AlpertandAndrew Clark 55a4b1f377 memo supports Hooks 2018-10-29 11:26:53 -07:00
Sophie AlpertandAndrew Clark 30aa4ad554 The Lost Effect, chapter 2
Previously, flushPassiveEffects (called by scheduling work) would overwrite rootWithPendingPassiveEffects before we had a chance to schedule the work.
2018-10-29 11:26:53 -07:00
Sebastian MarkbågeandAndrew Clark b772e0e26b "functional component" -> "function component" in hooks error messages 2018-10-29 11:26:53 -07:00
Sophie AlpertandAndrew Clark 9e9e3970e4 Warn for Hook set-state on unmounted component 2018-10-29 11:26:53 -07:00
Sophie AlpertandAndrew Clark 6514697f0c Make sure deletions don't stop passive effects
Before the fix, the passive effect in the test is never executed.

We were previously waiting until the next commit phase to run effects. Now, we run them before scheduling work.
2018-10-29 11:26:53 -07:00
dd019d34db Add support for hooks to ReactDOMServer
Co-authored-by: Alex Taylor <alexmckenley@gmail.com>
Co-authored-by: Andrew Clark <acdlite@fb.com>
2018-10-29 11:26:53 -07:00
Andrew ClarkandAndrew Clark 11d0781eea Defer useEffect until after paint
Effects scheduled by useEffect should not fire until after the browser
has had a chance to paint. However, they should be fired before any
subsequent mutations.

Also adds useMutationEffect and useLayoutEffect. useMutationEffect fires
during the host update phase. useLayoutEffect fires during the post-
update phase (the same phase as componentDidMount
and componentDidUpdate).
2018-10-29 11:26:53 -07:00
Andrew ClarkandAndrew Clark 105f2de545 Put hooks behind feature flag 2018-10-29 11:26:53 -07:00
Andrew ClarkandAndrew Clark 7bee9fbdd4 Initial hooks implementation
Includes:
- useState
- useContext
- useEffect
- useRef
- useReducer
- useCallback
- useMemo
- useAPI
2018-10-29 11:26:53 -07:00
Rauno FreibergandAndrew Clark 37c7fe0a5f Update createRoot warning message based on enableStableConcurrentModeAPIs (#14017) 2018-10-29 11:25:24 -07:00
Jeffrey ZhangandNathan Hunzaker ae4f3f07e5 Remove extraneous CSS selector (#13996) 2018-10-27 10:01:25 -07:00
JosephandNathan Hunzaker 95f98a1873 fix typo (#13955) 2018-10-27 09:59:00 -07:00
PatrickandNathan Hunzaker e217f2f1ac Updated comment for getEventModifierState (#13918) 2018-10-27 09:52:01 -07:00
Brian VaughnandGitHub 275e76e83b Enable stable concurrent APIs flag for 16.7 alpha (#13928)
* Add enableStableConcurrentModeAPIs feature flag

* Conditionally name concurrent API based on enableStableConcurrentModeAPIs flag
2018-10-24 13:45:07 -07:00
Dan AbramovandGitHub b5539ad628 It's Concurrent 2018-10-23 19:26:00 -07:00
Dan Abramov 0cc50b675a Fix scheduler fixture 2018-10-23 16:35:07 -07:00
Dan Abramov 8b97a9c36f Update bundle sizes for 16.6.0 release v16.6.0 2018-10-23 16:29:35 -07:00
Dan Abramov c8ade996e9 Update error codes for 16.6.0 release 2018-10-23 16:29:35 -07:00
Dan Abramov 6c29eabf78 Updating package versions for release 16.6.0 2018-10-23 16:23:41 -07:00
Dan Abramov d520b358d6 Revert all package versions to 16.5.2 state
Our release script is getting really confused so I'm resetting to last working state.
2018-10-23 16:18:28 -07:00
Dan Abramov 8f1ec7649e Bump versions to beta.0 2018-10-23 16:01:57 -07:00
Dan Abramov 5055a83fa4 Revert "Revert "Updating dependencies for react-noop-renderer""
This reverts commit 3e8b4a5b8b.
2018-10-23 15:59:36 -07:00
Brian Vaughn 3e8b4a5b8b Revert "Updating dependencies for react-noop-renderer"
This reverts commit 1a57dc6689.
2018-10-23 15:36:31 -07:00
Brian Vaughn ff5efb0390 Prettier 2018-10-23 15:06:58 -07:00
Brian VaughnandGitHub f4488bee51 Add skipCI flag to release script (#13933) 2018-10-23 15:05:14 -07:00
Dan AbramovandGitHub d42ed60026 Fix Suspense fixture (#13932) 2018-10-23 18:03:22 -04:00
Andrew ClarkandGitHub d8e03de4aa [react-cache] Remove cache as argument to read (#13865)
* [react-cache] Remove `cache` as argument to `read`

Updated is API is `Resource.read(key)` instead of
`Resource.read(cache, key)`.

The cache is read from context using `readContext`.

This also removes cache invalidation entirely (other than the default
LRU mechanism), as well as the ability to have multiple caches. We'll
add it back once `Context.write` lands and we can implement it the
right way.

Since there's now only a single cache (the global one), we don't
actually need to use context yet, but I've added a dummy context
anyway so the user gets an error if they attempt to read outside the
render phase.

* nits

* Add test for thenables that resolve multiple times
2018-10-23 14:38:51 -07:00
Andrew ClarkandBrian Vaughn fefa1269e2 Revert accidentally committed existence check (#13931) 2018-10-23 14:27:04 -07:00
Brian VaughnandGitHub 80a0c05ce3 Removed react-cache from the bundle list for now (#13930)
* Removed react-cache from the bundle list for now

* Re-add react-cache bundle, but mark as private to avoid NPM publishing
2018-10-23 13:55:52 -07:00
Brian VaughnandGitHub 915e4eab53 Add "unstable_" prefix to react-cache and jest-react (#13929)
* Add "unstable_" prefix to react-cache createResource and jest-react matchers
* Reverted accidental change to error-codes JSON
* Remove unstable_ prefix from internal React tests for jest-test
2018-10-23 13:55:37 -07:00
Dan AbramovandGitHub 508b5fba0e Fix Markdown 2018-10-23 12:16:13 -07:00
Dan AbramovandGitHub c285ea2700 Tweak changelog credits 2018-10-23 12:15:57 -07:00
Dan AbramovandGitHub eac092ecac Add 16.6.0 changelog (#13927)
* Add 16.6.0 changelog

* Update CHANGELOG.md
2018-10-23 15:08:08 -04:00
Andrew ClarkandGitHub cbbc2b6c4d [Synchronous Suspense] Suspending a class outside concurrent mode (#13926)
* [Synchronous Suspense] Suspending a class outside concurrent mode

When a class component suspends during mount outside concurrent mode,
change the tag so it's not mistaken for a completed component. For
example, we should not call componentWillUnmount if it is deleted.

* PR nits
2018-10-23 11:36:56 -07:00
Sebastian MarkbågeandGitHub 4947fcd762 Fix lint (#13923) 2018-10-22 22:47:39 -07:00
Sebastian MarkbågeandGitHub d75c69e0cf Remove unstable_ prefix from Suspense (#13922)
We are using it with lazy and the combination Suspense + lazy seems pretty
stable. maxDuration is not but that's only enabled when you're in
ConcurrentMode which is still unstable.
2018-10-22 22:40:05 -07:00
John LinandBrandon Dail c8ef2feda9 Remove redundant word "the" (#13919) 2018-10-22 22:39:23 -07:00
Andrew ClarkandGitHub 55444a6f49 Try rendering again if a timed out tree receives an update (#13921)
Found a bug related to suspending inside an already mounted tree. While
investigating this I noticed we really don't have much coverage of
suspended updates. I think this would greatly benefit from some fuzz
testing; still haven't thought of a good test case, though.
2018-10-22 22:37:15 -07:00
yongningfuandNathan Hunzaker 04c4f2fcea [reconciler] ReactFiberNewContext import maxSigned31BitInt twice (#13857)
* [reconciler] ReactFiberNewContext import maxSigned31BitInt twice

* rename maxSigned31BitInt to MAX_SIGNED_31_BIT_INT
2018-10-22 10:24:44 -05:00
Abdul RaufandNathan Hunzaker 409e472fca Add flow types in ReactControlledComponent (#13669) 2018-10-21 14:35:35 -05:00
Abdul RaufandNathan Hunzaker 663835a43a Add flow types in getEventModifierState (#13909) 2018-10-21 13:20:50 -05:00
Abdul RaufandNathan Hunzaker 82710097f6 Add flow types in getNodeForCharacterOffset (#13908) 2018-10-21 13:18:32 -05:00
shawn wangandNathan Hunzaker 7ebd90c2c3 [minor bugfix] fix minor bug with handleReset in suspense fixture (#13843)
* fix minor bug with handleReset in suspense fixture

otherwise resetting the cache in debugger throws an error 

reported here
https://www.reddit.com/r/reactjs/comments/9n9nfo/react_166_canary/

* fix singlequote/doublequote

* switch to performance.now()
2018-10-21 13:16:44 -05:00
Abdul RaufandNathan Hunzaker 420001cb4e Fix babel-preset-fbjs configure link in comment (#13666) 2018-10-21 12:23:24 -05:00
Andrew Clark b753f76a74 Fix failing async tests in Node 10
Dunno why they happened to work in Node 8 but whatever. Tested on both.
2018-10-20 16:06:23 -07:00
ZYSzysandNathan Hunzaker d37f595595 Add use strict to .prettierrc.js (#13787) 2018-10-20 17:42:11 -04:00
Dan AbramovandGitHub b5c0852fdd Bump version to 16.6.0-beta.0 (#13906)
* Bump version to 16.6.0-beta.0

* Root too
2018-10-20 13:03:15 -04:00
Dan AbramovandGitHub 769b1f270e pure -> memo (#13905) 2018-10-20 12:46:23 -04:00