aef7ce5547
This automatically exposes `$$FORM_ACTIONS` on Server References coming from Flight. So that when they're used in a form action, we can encode the ID for the server reference as a hidden field or as part of the name of a button. If the Server Action is a bound function it can have complex data associated with it. In this case this additional data is encoded as additional form fields. To process a POST on the server there's now a `decodeAction` helper that can take one of these progressive posts from FormData and give you a function that is prebound with the correct closure and FormData so that you can just invoke it. I updated the fixture which now has a "Server State" that gets automatically refreshed. This also lets us visualize form fields. There's no "Action State" here for showing error messages that are not thrown, that's still up to user space. |
||
---|---|---|
.. | ||
__tests__ | ||
README.md | ||
Types.js | ||
codes.json | ||
extract-errors.js | ||
invertObject.js | ||
transform-error-messages.js |
README.md
The error code system substitutes React's error messages with error IDs to provide a better debugging support in production. Check out the blog post here.
codes.json
contains the mapping from IDs to error messages. This file is generated by the Gulp plugin and is used by both the Babel plugin and the error decoder page in our documentation. This file is append-only, which means an existing code in the file will never be changed/removed.extract-errors.js
is an node script that traverses our codebase and updatescodes.json
. You can test it by runningyarn extract-errors
. It works by crawling the build artifacts directory, so you need to have either run the build script or downloaded pre-built artifacts (e.g. withyarn download build
). It works with partial builds, too.transform-error-messages
is a Babel pass that rewrites error messages to IDs for a production (minified) build.