-
Notifications
You must be signed in to change notification settings - Fork 47k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Docs] Error Codes Page #6946
[Docs] Error Codes Page #6946
Conversation
…e-reassemble-error-page
…reassemble-error-page
desc "copy error codes to docs" | ||
task :copy_error_codes do | ||
codes_json = File.read('../scripts/error-codes/codes.json') | ||
codes_js = "var errorMap = ".concat(codes_json) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codes_js = 'var errorMap = ' + codes_json + ';'
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just go all the way and use interpolation.
codes_js = "var errorMap = #{codes_json};"
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How about codes_js = "var errorMap = #{codes_json.chomp};\n"
?
@keyanzhang updated the pull request. |
@keyanzhang updated the pull request. |
@keyanzhang updated the pull request. |
const segments = str.split(urlRegex); | ||
|
||
for (let i = 0; i < segments.length; i++) { | ||
const matchIdx = matchResult.indexOf(segments[i]); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You shouldn't need to run a separate match; with the split regex you have the URLs will always be in odd positions and the text in even positions.
This generally looks good to me. I want to work on the wording a bit: will comment here later today. |
@keyanzhang updated the pull request. |
@@ -0,0 +1,15 @@ | |||
--- | |||
id: error-codes | |||
title: React Error Codes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggested "Error Decoder" and still like that (I think it's cute) but if you prefer this let's just do "Error Codes" without the "React".
@keyanzhang updated the pull request. |
Looks great, thanks! |
(cherry picked from commit cf73de9)
Implements the 2nd part of #6874. The JSON file built by #6882 is now fed to the page.
CC @spicyj @zpao since this PR modifies the build steps of our docs. Thanks!
A demo can be found here.