From 8b834034d63252762638c3dd46c09f11b2a72689 Mon Sep 17 00:00:00 2001 From: Brian Vaughn Date: Mon, 3 May 2021 16:57:17 -0400 Subject: [PATCH] Improve DevTools bug template text (#21413) --- .../views/ErrorBoundary/ReportNewIssue.js | 56 ++++++++++++------- 1 file changed, 37 insertions(+), 19 deletions(-) diff --git a/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ReportNewIssue.js b/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ReportNewIssue.js index d54115ef6d7c5..8dd3be4ad3851 100644 --- a/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ReportNewIssue.js +++ b/packages/react-devtools-shared/src/devtools/views/ErrorBoundary/ReportNewIssue.js @@ -11,6 +11,10 @@ import * as React from 'react'; import Icon from '../Icon'; import styles from './shared.css'; +function encodeURIWrapper(string: string): string { + return encodeURI(string).replace(/#/g, '%23'); +} + type Props = {| callStack: string | null, componentStack: string | null, @@ -28,26 +32,40 @@ export default function ReportNewIssue({ } const title = `Error: "${errorMessage || ''}"`; - const label = 'Component: Developer Tools'; - - let body = 'Describe what you were doing when the bug occurred:'; - body += '\n1. '; - body += '\n2. '; - body += '\n3. '; - body += '\n\n---------------------------------------------'; - body += '\nPlease do not remove the text below this line'; - body += '\n---------------------------------------------'; - body += `\n\nDevTools version: ${process.env.DEVTOOLS_VERSION || ''}`; - if (callStack) { - body += `\n\nCall stack: ${callStack.trim()}`; - } - if (componentStack) { - body += `\n\nComponent stack: ${componentStack.trim()}`; - } + const labels = ['Component: Developer Tools', 'Status: Unconfirmed']; + + const body = ` + + +### Which website or app were you using when the bug happened? + +Please provide a link to the URL of the website (if it is public), a CodeSandbox (https://codesandbox.io/s/new) example that reproduces the bug, or a project on GitHub that we can checkout and run locally. + +### What were you doing on the website or app when the bug happened? + +If possible, please describe how to reproduce this bug on the website or app mentioned above: +1. +2. +3. + + + + + +### Generated information + +DevTools version: ${process.env.DEVTOOLS_VERSION || ''} + +Call stack: +${callStack || '(not available)'} + +Component stack: +${componentStack || '(not available)'} + `; - bugURL += `/issues/new?labels=${encodeURI(label)}&title=${encodeURI( - title, - )}&body=${encodeURI(body)}`; + bugURL += `/issues/new?labels=${encodeURIWrapper( + labels.join(','), + )}&title=${encodeURIWrapper(title)}&body=${encodeURIWrapper(body.trim())}`; return (