Skip to content

fix: ensure signing out cannot cause any runtime render errors #13137

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

Merged
merged 21 commits into from
May 3, 2024
Merged
Changes from 1 commit
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
4da94ef
fix: remove some of the jank around our core App component
Parkreiner May 2, 2024
9986024
refactor: scope navigation logic more aggressively
Parkreiner May 2, 2024
7004c9c
refactor: add explicit return type to useAuthenticated
Parkreiner May 2, 2024
ebfaec5
refactor: clean up ProxyContext code
Parkreiner May 2, 2024
1192eb3
wip: add code for consolidating the HTML metadata
Parkreiner May 2, 2024
bbe2ae0
refactor: clean up hook logic
Parkreiner May 2, 2024
1c41937
refactor: rename useHtmlMetadata to useEmbeddedMetadata
Parkreiner May 2, 2024
79e9c45
fix: correct names that weren't updated
Parkreiner May 2, 2024
81f2cd9
fix: update type-safety of useEmbeddedMetadata further
Parkreiner May 2, 2024
390418f
wip: switch codebase to use metadata hook
Parkreiner May 3, 2024
486f292
Merge branch 'main' into mes/login-fix
Parkreiner May 3, 2024
b77af73
Merge branch 'mes/login-fix' of https://github.com/coder/coder into m…
Parkreiner May 3, 2024
e072f7a
refactor: simplify design of metadata hook
Parkreiner May 3, 2024
2a58322
fix: update stray type mismatches
Parkreiner May 3, 2024
b55abb7
fix: more type fixing
Parkreiner May 3, 2024
c45e1b7
fix: resolve illegal invocation error
Parkreiner May 3, 2024
2a63c1d
fix: get metadata issue resolved
Parkreiner May 3, 2024
4d3b155
fix: update comments
Parkreiner May 3, 2024
8067e77
chore: add unit tests for MetadataManager
Parkreiner May 3, 2024
5e6e974
fix: beef up tests
Parkreiner May 3, 2024
772b96f
fix: update typo in tests
Parkreiner May 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
fix: remove some of the jank around our core App component
  • Loading branch information
Parkreiner committed May 2, 2024
commit 4da94ef26c49fb4ac5127b003cb464d97d1a1cb5
26 changes: 20 additions & 6 deletions site/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,23 @@ export const AppProviders: FC<AppProvidersProps> = ({
}) => {
// https://tanstack.com/query/v4/docs/react/devtools
const [showDevtools, setShowDevtools] = useState(false);

useEffect(() => {
window.toggleDevtools = () => setShowDevtools((old) => !old);
// eslint-disable-next-line react-hooks/exhaustive-deps -- no dependencies needed here
// Storing key in variable to avoid accidental typos; we're working with the
// window object, so there's basically zero type-checking available
const toggleKey = "toggleDevtools";

// Don't want to throw away the previous devtools value if some other
// extension added something already
const devtoolsBeforeSync = window[toggleKey];
window[toggleKey] = () => {
devtoolsBeforeSync?.();
setShowDevtools((current) => !current);
};

return () => {
window[toggleKey] = devtoolsBeforeSync;
};
}, []);

return (
Expand All @@ -60,10 +74,10 @@ export const AppProviders: FC<AppProvidersProps> = ({

export const App: FC = () => {
return (
<AppProviders>
<ErrorBoundary>
<ErrorBoundary>
<AppProviders>
<RouterProvider router={router} />
</ErrorBoundary>
</AppProviders>
</AppProviders>
</ErrorBoundary>
Comment on lines +77 to +81
Copy link
Member Author

Choose a reason for hiding this comment

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

Important – before, if any of the sub-components in AppProviders threw an error, we had nothing to catch it. Moved ErrorBoundary to be the top-most component

);
};