Skip to content

Commit

Permalink
Add a debug tool to help clear local storage when it is incompatible …
Browse files Browse the repository at this point in the history
…with the current version.
  • Loading branch information
danielnaab committed Feb 2, 2024
1 parent 44d1c20 commit c008eab
Show file tree
Hide file tree
Showing 6 changed files with 54 additions and 5 deletions.
1 change: 1 addition & 0 deletions apps/cli/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"extends": "../../tsconfig.json",
"compilerOptions": {
"module": "CommonJS",
"outDir": "./dist",
"emitDeclarationOnly": true
},
Expand Down
3 changes: 2 additions & 1 deletion apps/spotlight/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"astro": "^3.5.4",
"cheerio": "1.0.0-rc.12",
"react": "^18.2.0",
"react-dom": "^18.2.0"
"react-dom": "^18.2.0",
"react-error-boundary": "^4.0.12"
},
"devDependencies": {
"@astrojs/check": "^0.3.1",
Expand Down
17 changes: 16 additions & 1 deletion apps/spotlight/src/components/AppAvailableFormList.tsx
Original file line number Diff line number Diff line change
@@ -1,11 +1,26 @@
import React from 'react';
import { ErrorBoundary } from 'react-error-boundary';

import { AvailableFormList } from '@atj/design';
import { getAppContext } from '../context';
import { getFormUrl } from '../routes';
import DebugTools from './DebugTools';

export default () => {
const ctx = getAppContext();
return (
<AvailableFormList formService={ctx.formService} urlForForm={getFormUrl} />
<ErrorBoundary
fallback={
<div>
There was an unexpected error rendering the form list.
<DebugTools />
</div>
}
>
<AvailableFormList
formService={ctx.formService}
urlForForm={getFormUrl}
/>
</ErrorBoundary>
);
};
18 changes: 18 additions & 0 deletions apps/spotlight/src/components/DebugTools.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import React from 'react';

export default function DebugTools() {
return (
<section>
<button
className="usa-button"
onClick={() => {
console.log('clearing');
window.localStorage.clear();
window.location.reload();
}}
>
Delete all demo data (clear browser local storage)
</button>
</section>
);
}
2 changes: 2 additions & 0 deletions apps/spotlight/src/pages/index.astro
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
---
import ContentLayout from '../layouts/ContentLayout.astro';
import AppAvailableFormList from '../components/AppAvailableFormList';
import DebugTools from '../components/DebugTools';
---

<ContentLayout title="10x Access to Justice Spotlight">
<h1>10x Access to Justice Spotlight</h1>
<AppAvailableFormList client:only />
<DebugTools client:only />
</ContentLayout>
18 changes: 15 additions & 3 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit c008eab

Please sign in to comment.