react-cache alphas don't work with 16.8+

Created on 6 Feb 2019  ·  11Comments  ·  Source: facebook/react

react-cache was not published with 16.8.1 like the rest of the react packages.
This means that the platform's Suspense stuff will not work.

_Originally posted by @jaredpalmer in https://github.com/palmerhq/the-platform/pull/70#issuecomment-461170282_

Stale Question

Most helpful comment

The current solution is indeed building from source, but if people want to streamline the process, you can try adding this to your package.json:

  "scripts": {
    "postinstall": "git clone [email protected]:facebook/react.git --depth=1 && cd react && yarn install --frozen-lockfile && npm run build react-cache && cd .. && npm i $(npm pack ./react/build/node_modules/react-cache) && rm -rf react react-cache-*.tgz"
  },

credit goes to this stackoverflow answer

It would be awesome if react took advantage of the npm's "prepare" script _and_ npm allowed installing from directories in git repos, but thats not likely going to change any time soon. For now, this solution is fine

All 11 comments

Running into this error with [email protected]:

TypeError: dispatcher is undefined
This comes from the readContext() function in react-cache-development.js,

This can be closed.

We are building react-cache from master and using a vendor folder in the example of the-platform. Previously it was improperly included as dependency instead of a peer dependency in the-platform.

Yeah I think for now our recommendation is that you can copy paste its source but then you're on your own. The caching strategy is very unclear now and the whole thing will likely change a lot. We don't want any reusable libraries to start depending on it.

We could plausibly add a big red warning on its import and then publish another alpha. If someone sends a PR seems ok to do it.

I'd like to try to add a warning on import, it would however be my first contribution.

How are we able to experiment with react-cache and Concurrent Mode at the moment? Since I am running into this issue with the versions below 😅

"react": "16.8.0-alpha.1",
"react-cache": "2.0.0-alpha.1",
"react-dom": "16.8.0-alpha.1",

@bitttttten This is Suspense demo run in react "16.8" version. You can try suspense demo in the branch use-suepense. Hope help you.

If you want to experiment you should be able to build from source. :-)

Seems like building it from source is the only way for now.

The current solution is indeed building from source, but if people want to streamline the process, you can try adding this to your package.json:

  "scripts": {
    "postinstall": "git clone [email protected]:facebook/react.git --depth=1 && cd react && yarn install --frozen-lockfile && npm run build react-cache && cd .. && npm i $(npm pack ./react/build/node_modules/react-cache) && rm -rf react react-cache-*.tgz"
  },

credit goes to this stackoverflow answer

It would be awesome if react took advantage of the npm's "prepare" script _and_ npm allowed installing from directories in git repos, but thats not likely going to change any time soon. For now, this solution is fine

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contribution.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please create a new issue with up-to-date information. Thank you!

Was this page helpful?
0 / 5 - 0 ratings