next.js
fce0ded0 - fix: improve error message if an MPA action has an unrecognized id

Commit
258 days ago
fix: improve error message if an MPA action has an unrecognized id If an action id is not found in the module map, `decodeAction` throws: ``` Error: Could not find the module "{id}" in the React Server Manifest. This is probably a bug in the React Server Components bundler. ``` This is inconsistent with fetch actions, where we print an error message that links to docs. This PR fixes that. *Implementation notes* In order to replace react's error message, we can wrap the server action manifest in a proxy that throws a special error if the action is missing. Note that this error will then bubble up from the action handler and show the default 500 page. (this was existing behavior, unaffected by this PR.) That this is also inconsistent with fetch actions which log this as a 404, but showing a 404 HTML page would not be appropriate, so the current behavior at least gets us a decent result -- seeing a 500 should make the user refresh the page, which should fix the unrecognized action error. (which usually comes from client-side version skew). Also note that, unlike fetch actions, we're currently not respecting `global-error.tsx` or `error.tsx` when doing this. But doing this correctly seems quite involved, so i'm leaving that for a future PR.
Author
Committer
Parents
Loading