rsnext/test/development
Adrian Bettridge-Wiese 3c84b3ac99
Add useOptimistic to client-only errors (#53313)
### 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>
2023-08-03 07:21:00 +00:00
..
acceptance fix Next.rs API (#53456) 2023-08-02 14:31:52 +02:00
acceptance-app Add useOptimistic to client-only errors (#53313) 2023-08-03 07:21:00 +00:00
api-cors-with-rewrite fix(#11930): rewritten api routes can correctly handle cors in dev mode (#38937) 2022-07-29 21:39:43 -05:00
api-route-errors Update dev logs to include request timings (#49191) 2023-05-04 12:33:03 -07:00
app-dir/multiple-compiles-single-route Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
app-hmr fix env reloading for turbopack (#52194) 2023-07-04 19:28:34 +00:00
app-render-error-log Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
basic Add list of aliased lucide-react icons to the transform rules (#53483) 2023-08-02 11:38:40 +00:00
client-dev-overlay Allowing hiding the ReactDevOverlay (#37417) 2022-06-06 14:21:53 -04:00
correct-tsconfig-defaults chore(test): fix flaky tsconfig.json test (#53132) 2023-07-24 14:33:55 -07:00
dotenv-default-expansion Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
gssp-notfound Ensure next.url is used instead of next.appPort (#44163) 2022-12-19 13:29:50 -08:00
jsconfig-path-reloading Update default moduleResolution in tsconfig.json from node to bundler (#51957) 2023-07-18 15:11:09 +00:00
middleware-warnings refactor tests for readability (#51051) 2023-06-21 19:47:21 +00:00
next-font Remove experimental config from create-next-app (#49241) 2023-05-05 00:22:28 -07:00
project-directory-with-styled-jsx-suffix fix: allow user directory with styled-jsx prefix in next dev (#41484) 2022-10-19 19:01:48 +00:00
repeated-dev-edits Add test checking that repeated edits won't cause hydration issues (#44189) 2022-12-21 14:17:50 +01:00
tsconfig-path-reloading Update default moduleResolution in tsconfig.json from node to bundler (#51957) 2023-07-18 15:11:09 +00:00
typescript-auto-install Update test config (#43661) 2022-12-03 19:49:00 -08:00
watch-config-file Auto-restart dev server when next.config.js changes (#47912) 2023-04-05 18:17:54 +00:00
webpack-issuer-deprecation-warning fix(next): use moduleGraph.getIssuer to avoid deprecation warning (#36329) (#36330) 2022-04-21 14:14:03 +00:00