Skip to content

Commit

Permalink
fix: query
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <[email protected]>
  • Loading branch information
Innei committed Jun 27, 2023
1 parent 032bf39 commit 5d5c759
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions src/components/widgets/comment/CommentBox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ const createInitialValue = () => ({
text: atom(''),
refId: atom(''),
})

const CommentBoxContext = createContext(createInitialValue())

const CommentBoxProvider = (props: PropsWithChildren) => {
Expand All @@ -33,6 +34,7 @@ const enum CommentBoxMode {
'legacy',
'with-auth',
}

export const CommentBox: FC<CommentBaseProps> = (props) => {
const [mode, setMode] = useState<CommentBoxMode>(CommentBoxMode['with-auth'])
return (
Expand Down Expand Up @@ -75,6 +77,7 @@ const CommentBoxWithAuth = () => {
</AutoResizeHeight>
)
}

const CommentAuthedInputSkeleton = () => {
const color = 'bg-gray-200/50 dark:bg-zinc-800/50'
return (
Expand All @@ -89,6 +92,7 @@ const CommentAuthedInputSkeleton = () => {
</div>
)
}

const CommentAuthedInput = () => {
const { user } = useUser()
if (!user) return <CommentAuthedInputSkeleton />
Expand Down
2 changes: 1 addition & 1 deletion src/providers/root/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,13 @@ export function Providers({ children }: PropsWithChildren) {
return (
<>
<SocketContainer />
<ModalStackProvider key="modalStackProvider" />
<ProviderComposer contexts={contexts}>
{children}
<EventProvider key="viewportProvider" />
<SentryProvider key="SentryProvider" />
<PageScrollInfoProvider key="PageScrollInfoProvider" />
<DebugProvider key="debugProvider" />
<ModalStackProvider key="modalStackProvider" />
</ProviderComposer>
</>
)
Expand Down
3 changes: 2 additions & 1 deletion src/providers/root/react-query-provider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,8 @@ const persister = {
export const queryClient = new QueryClient({
defaultOptions: {
queries: {
cacheTime: 1000 * 60 * 5, // 5 minutes
staleTime: 1000 * 60 * 5, // 5 minutes

refetchInterval: 1000 * 60 * 5, // 5 minutes
refetchOnWindowFocus: false,
refetchIntervalInBackground: false,
Expand Down
2 changes: 1 addition & 1 deletion src/utils/query-client.server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { cache } from 'react'
const queryClient = new QueryClient({
defaultOptions: {
queries: {
// cacheTime: 0,
staleTime: 1000 * 3,
cacheTime: 1000 * 3,
},
},
})
Expand Down

0 comments on commit 5d5c759

Please sign in to comment.