Skip to content
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

DevTools error boundary: Search for pre-existing GH issues #21279

Merged
merged 2 commits into from
Apr 15, 2021

Conversation

bvaughn
Copy link
Contributor

@bvaughn bvaughn commented Apr 15, 2021

Previously the error boundary UI in DevTools showed a link to report the error on GitHub. This was helpful but resulted in a lot of duplicate issues. This commit adds an intermediate step of searching GitHub issues (using the public API) to find a pre-existing match and linking to it instead if one is found. Hopefully this will encourage people to add info to existing issues rather than report duplicates.

Note that I'm using the rate-limited (10 requests per minute) no-auth-token API and so a fallback to the previous behavior is in place for both timeouts and errors.

No matching issues

If DevTools can't find a likely match, it will show the "report" link like before (with an added prompt to please include repro steps)
Error boundary UI with no matching issues found

Matching issue

If DevTools finds a likely match, it links to that issue instead (to hopefully encourage people to add additional context).
Error boundary UI with matching issue found

@facebook-github-bot facebook-github-bot added CLA Signed React Core Team Opened by a member of the React Core Team labels Apr 15, 2021
@sizebot
Copy link

sizebot commented Apr 15, 2021

Comparing: 96d00b9...d61818f

Critical size changes

Includes critical production bundles, as well as any change greater than 2%:

Name +/- Base Current +/- gzip Base gzip Current gzip
oss-stable/react-dom/cjs/react-dom.production.min.js = 122.72 kB 122.72 kB = 39.39 kB 39.39 kB
oss-experimental/react-dom/cjs/react-dom.production.min.js = 129.30 kB 129.30 kB = 41.47 kB 41.48 kB
facebook-www/ReactDOM-prod.classic.js = 412.22 kB 412.22 kB = 76.24 kB 76.23 kB
facebook-www/ReactDOM-prod.modern.js = 400.29 kB 400.29 kB = 74.32 kB 74.32 kB
facebook-www/ReactDOMForked-prod.classic.js = 412.22 kB 412.22 kB = 76.24 kB 76.24 kB

Significant size changes

Includes any change greater than 0.2%:

(No significant changes)

Generated by 🚫 dangerJS against d61818f

@bvaughn bvaughn force-pushed the devtools-issues-search branch from 1efcd60 to 429b542 Compare April 15, 2021 14:48
@bvaughn bvaughn changed the title [DRAFT] DevTools error boundary: Search for pre-existing GH issues DevTools error boundary: Search for pre-existing GH issues Apr 15, 2021
@bvaughn bvaughn marked this pull request as ready for review April 15, 2021 14:51
Comment on lines +23 to +31
const filters = [
// Unfortunately "repo" and "org" filters don't work
// Hopefully the label filter will be sufficient.
'in:title',
'is:issue',
'is:open',
'is:public',
'label:"Component: Developer Tools"',
];
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you're using the filters correctly? This works A-OK:

https://api.github.com/search/issues?q=repo:facebook/react+is:issue+is:open+is:public+in:title+Error

Copy link
Contributor Author

@bvaughn bvaughn Apr 15, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure you're using the filters correctly?

Yes, it works when used in the URL but it doesn't work when passed to the JS API. When I add either repo or org filters to the query it fails with:

The listed users and repositories cannot be searched either because the resources do not exist or you do not have permission to view them.

Please let me know if you can figure out a way to make this work. I'd be happy to tweak the search.

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just ran this through Octokit and it provided the right results:

await octokit.rest.search.issuesAndPullRequests({ q: 'Error repo:facebook/react is:issue is:open' })

{
    "total_count": 191,
    "incomplete_results": false,
    "items": Array(30)
}

await octokit.rest.search.issuesAndPullRequests({ q: 'Error org:facebook is:issue is:open' })

{
    "total_count": 5269,
    "incomplete_results": false,
    "items": Array(30)
}

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's so bizarre. Literally what I tried doing yesterday and it wasn't working.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously the error boundary UI in DevTools showed a link to report the error on GitHub. This was helpful but resulted in a lot of duplicate issues. This commit adds an intermediate step of searching GitHub issues (using the public API) to find a pre-existing match and linking to it instead if one is found. Hopefully this will encourage people to add info to existing issues rather than report duplicates.
@bvaughn bvaughn force-pushed the devtools-issues-search branch from 429b542 to b9b6de4 Compare April 15, 2021 15:29
@bvaughn
Copy link
Contributor Author

bvaughn commented Apr 15, 2021

I'm going to move forward with this so I can test it within Facebook. Happy to follow up with any PR suggestions or improvements after the fact. :)

@bvaughn bvaughn merged commit f3337aa into facebook:master Apr 15, 2021
@bvaughn bvaughn deleted the devtools-issues-search branch April 15, 2021 17:34
koto pushed a commit to koto/react that referenced this pull request Jun 15, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed React Core Team Opened by a member of the React Core Team
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants