[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
This commit is contained in:
Andrew Clark
2018-10-23 14:38:51 -07:00
committed by GitHub
parent fefa1269e2
commit d8e03de4aa
11 changed files with 758 additions and 718 deletions
+1 -1
View File
@@ -377,7 +377,7 @@ const bundles = [
moduleType: ISOMORPHIC,
entry: 'react-cache',
global: 'ReactCache',
externals: ['react'],
externals: ['react', 'scheduler'],
},
/******* createComponentWithSubscriptions (experimental) *******/