Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit Hold shift + click to select a range
edb3d1e
fix: migrate over time changes
buenos-nachos Apr 28, 2025
39d8641
Merge branch 'main' into mes/use-time-2
buenos-nachos Apr 28, 2025
93f85c4
docs: add one more todo
buenos-nachos Apr 28, 2025
ba92d78
fix: resolve memoization wonkiness
buenos-nachos Apr 29, 2025
e642293
docs: rewrite comment for clarity
buenos-nachos Apr 29, 2025
1bc9463
refactor: slight cleanup
buenos-nachos Apr 29, 2025
ee76345
fix: revamp the API design to remove risks of infinite renders
buenos-nachos Apr 30, 2025
0ca593b
fix: beef up subscription update method
buenos-nachos Apr 30, 2025
fc0694c
fix: add back logic that was removed during merge
buenos-nachos Apr 30, 2025
ebe8821
chore: add provider to base Storybook meta
buenos-nachos Apr 30, 2025
90f2146
fix: add decorator to right place
buenos-nachos Apr 30, 2025
532ec85
fix: remove ghost import
buenos-nachos Apr 30, 2025
8c5c49d
fix: get rid of UMD import warnings
buenos-nachos Apr 30, 2025
30283f0
Merge branch 'main' into mes/use-time-2
buenos-nachos May 7, 2025
9f258a2
Merge branch 'mes/use-time-2' of https://github.com/coder/coder into …
buenos-nachos May 7, 2025
62e5f8e
refactor: split up TimeSync into vanilla file and React file
buenos-nachos May 7, 2025
60b2220
fix: move resync option back to base class
buenos-nachos May 7, 2025
62b6f6e
chore: flesh out more of React class
buenos-nachos May 7, 2025
fe8b3ef
fix: get initial solution in place for fixing stale closure issues
buenos-nachos May 7, 2025
9d8671e
refactor: make class less confusing
buenos-nachos May 7, 2025
997c3da
chore: format
buenos-nachos May 7, 2025
d0a57de
docs: add more info about properties
buenos-nachos May 7, 2025
da5803d
refactor: split useTimeSync into two hooks
buenos-nachos May 7, 2025
08fda7b
fix: add back type-checking
buenos-nachos May 7, 2025
5233fb8
chore: finish initial implementation of onSubscriptionAdd
buenos-nachos May 7, 2025
93cf58a
fix: make error case more clear
buenos-nachos May 9, 2025
5ba068a
docs: add notes about potential other approach for hook
buenos-nachos May 9, 2025
f352e3b
fix: remove dependencies from hook API
buenos-nachos May 9, 2025
b5a6870
refactor: clean up code
buenos-nachos May 9, 2025
10fbdfc
refactor: make hook less confusing
buenos-nachos May 9, 2025
d7c70e2
fix: resolve bug when syncing new interval
buenos-nachos May 9, 2025
0ffe2af
fix: remove race condition in caching logic
buenos-nachos May 9, 2025
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: migrate over time changes
  • Loading branch information
buenos-nachos committed Apr 28, 2025
commit edb3d1e425cf8e2cc9720d5fc128ee0dd2eb0b76
23 changes: 14 additions & 9 deletions site/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import { GlobalSnackbar } from "./components/GlobalSnackbar/GlobalSnackbar";
import { ThemeProvider } from "./contexts/ThemeProvider";
import { AuthProvider } from "./contexts/auth/AuthProvider";
import { router } from "./router";
import { TimeSyncProvider } from "hooks/useTimeSync";

const defaultQueryClient = new QueryClient({
defaultOptions: {
Expand All @@ -37,6 +38,8 @@ declare global {
}
}

const initialDatetime = new Date();

export const AppProviders: FC<AppProvidersProps> = ({
children,
queryClient = defaultQueryClient,
Expand Down Expand Up @@ -64,15 +67,17 @@ export const AppProviders: FC<AppProvidersProps> = ({

return (
<HelmetProvider>
<QueryClientProvider client={queryClient}>
<AuthProvider>
<ThemeProvider>
{children}
<GlobalSnackbar />
</ThemeProvider>
</AuthProvider>
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
</QueryClientProvider>
<TimeSyncProvider options={{ initialDatetime }}>
<QueryClientProvider client={queryClient}>
<AuthProvider>
<ThemeProvider>
{children}
<GlobalSnackbar />
</ThemeProvider>
</AuthProvider>
{showDevtools && <ReactQueryDevtools initialIsOpen={showDevtools} />}
</QueryClientProvider>
</TimeSyncProvider>
</HelmetProvider>
);
};
Expand Down
8 changes: 7 additions & 1 deletion site/src/components/SignInLayout/SignInLayout.tsx
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
import type { Interpolation, Theme } from "@emotion/react";
import { useTimeSync } from "hooks/useTimeSync";
import type { FC, PropsWithChildren } from "react";

export const SignInLayout: FC<PropsWithChildren> = ({ children }) => {
const year = useTimeSync({
maxRefreshIntervalMs: Number.POSITIVE_INFINITY,
select: (date) => date.getFullYear(),
});

return (
<div css={styles.container}>
<div css={styles.content}>
<div css={styles.signIn}>{children}</div>
<div css={styles.copyright}>
{"\u00a9"} {new Date().getFullYear()} Coder Technologies, Inc.
{"\u00a9"} {year} Coder Technologies, Inc.
</div>
</div>
</div>
Expand Down
43 changes: 0 additions & 43 deletions site/src/hooks/useTime.ts

This file was deleted.

Loading