🐛 Fixed Gscan type error crashing settings (#19994)

ref ENG-189

- A type error was flagged by Sentry where Settingscrashed where the API
data wasn't formatted correctly and the error boundary didn't kick in.
- This adds additional safety to ensure the required data exists before
attempting to render the elements.
This commit is contained in:
Ronald Langeveld 2024-04-08 16:01:41 +08:00 committed by GitHub
parent 58e5aa5b53
commit d319718281
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -45,7 +45,7 @@ const ThemeInstalledModal: React.FC<{
const handleError = useHandleError(); const handleError = useHandleError();
let errorPrompt = null; let errorPrompt = null;
if (installedTheme.gscan_errors) { if (installedTheme && installedTheme.gscan_errors) {
errorPrompt = <div className="mt-6"> errorPrompt = <div className="mt-6">
<List hint={<>Highly recommended to fix, functionality <strong>could</strong> be restricted</>} title="Errors"> <List hint={<>Highly recommended to fix, functionality <strong>could</strong> be restricted</>} title="Errors">
{installedTheme.gscan_errors?.map(error => <ThemeProblemView problem={error} />)} {installedTheme.gscan_errors?.map(error => <ThemeProblemView problem={error} />)}
@ -54,7 +54,7 @@ const ThemeInstalledModal: React.FC<{
} }
let warningPrompt = null; let warningPrompt = null;
if (installedTheme.warnings) { if (installedTheme && installedTheme.warnings) {
warningPrompt = <div className="mt-10"> warningPrompt = <div className="mt-10">
<List title="Warnings"> <List title="Warnings">
{installedTheme.warnings?.map(warning => <ThemeProblemView problem={warning} />)} {installedTheme.warnings?.map(warning => <ThemeProblemView problem={warning} />)}