@xk2800/nextjs-template 0.7.1-beta.4 → 0.7.1-beta.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -7,7 +7,8 @@ import FeedbackDialog from "./feedbackDialog"
|
|
|
7
7
|
// One hidden feedback dialog for reporting errors. Mount <ErrorFeedbackHost />
|
|
8
8
|
// once in a layout, only when feedback is configured (FEEDBACK_DISCORD_WEBHOOK_URL
|
|
9
9
|
// or FEEDBACK_EMAIL). Error toasts (toastError) and error pages (reportProblem)
|
|
10
|
-
// then open it as a bug report with the error
|
|
10
|
+
// then open it as a bug report with the error attached (sent with the report,
|
|
11
|
+
// not shown in the message box). Where
|
|
11
12
|
// it isn't mounted, toastError is a plain toast.error.
|
|
12
13
|
let openReport: ((errorText: string) => void) | null = null
|
|
13
14
|
const listeners = new Set<() => void>()
|
|
@@ -31,9 +32,6 @@ export function ErrorFeedbackHost() {
|
|
|
31
32
|
onOpenChange={(open) => !open && setErrorText(null)}
|
|
32
33
|
defaultType="bug"
|
|
33
34
|
errorDetails={errorText ?? undefined}
|
|
34
|
-
defaultMessage={
|
|
35
|
-
errorText ? `Error: ${errorText}\n\nWhat were you doing when this happened?\n` : ""
|
|
36
|
-
}
|
|
37
35
|
/>
|
|
38
36
|
)
|
|
39
37
|
}
|
|
@@ -62,13 +62,13 @@ export default function FeedbackDialog({
|
|
|
62
62
|
const [message, setMessage] = useState(defaultMessage)
|
|
63
63
|
const [isSending, setIsSending] = useState(false)
|
|
64
64
|
|
|
65
|
-
// With a pre-filled message,
|
|
66
|
-
// second error report doesn't start from the first one's text.
|
|
67
|
-
// keep whatever the user had typed (a closed dialog keeps its draft).
|
|
65
|
+
// With a pre-filled message or attached error, reset every time the dialog
|
|
66
|
+
// opens so a second error report doesn't start from the first one's text.
|
|
67
|
+
// Otherwise keep whatever the user had typed (a closed dialog keeps its draft).
|
|
68
68
|
const [wasOpen, setWasOpen] = useState(open)
|
|
69
69
|
if (open !== wasOpen) {
|
|
70
70
|
setWasOpen(open)
|
|
71
|
-
if (open && defaultMessage) {
|
|
71
|
+
if (open && (defaultMessage || errorDetails)) {
|
|
72
72
|
setType(defaultType)
|
|
73
73
|
setMessage(defaultMessage)
|
|
74
74
|
}
|