3c84b3ac99
### What? This PR makes it so calling `experimental_useOptimistic` throws an error telling you it only works in a client component. Because the Next docs have an example of renaming it into `useOptimistic` in the import, I also added that as a forbidden import. There may be a better way to do this, if so, please let me know. Fixes #53312 ### Why? Currently, the error you get says `(0 , react__WEBPACK_IMPORTED_MODULE_1__.experimental_useOptimistic) is not a function or its return value is not iterable`. This is misleading. <img width="1043" alt="Screenshot 2023-07-28 at 3 30 10 PM" src="https://github.com/vercel/next.js/assets/12662580/ee16fd84-633d-47a1-8db4-cfc050546614"> ### How? Adds `experimental_useOptimistic` to the lists of forbidden imports. Adds some specific tests around this, but I'm not sure they're necessary, looking at how the other tests are written. Co-authored-by: Zack Tanner <1939140+ztanner@users.noreply.github.com> |
||
---|---|---|
.. | ||
acceptance | ||
acceptance-app | ||
api-cors-with-rewrite | ||
api-route-errors | ||
app-dir/multiple-compiles-single-route | ||
app-hmr | ||
app-render-error-log | ||
basic | ||
client-dev-overlay | ||
correct-tsconfig-defaults | ||
dotenv-default-expansion | ||
gssp-notfound | ||
jsconfig-path-reloading | ||
middleware-warnings | ||
next-font | ||
project-directory-with-styled-jsx-suffix | ||
repeated-dev-edits | ||
tsconfig-path-reloading | ||
typescript-auto-install | ||
watch-config-file | ||
webpack-issuer-deprecation-warning |