Skip to content

Commit

Permalink
Merge pull request #910 from The-Commit-Company/909-review-all-apis-t…
Browse files Browse the repository at this point in the history
…hat-are-not-revalidating-because-of-app-cache

fix: refetch channels and members on load
  • Loading branch information
nikkothari22 authored May 7, 2024
2 parents d2e5dfe + a75ec47 commit 334159f
Show file tree
Hide file tree
Showing 9 changed files with 3 additions and 10 deletions.
3 changes: 1 addition & 2 deletions raven-app/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import { ChannelRedirect } from './utils/channel/ChannelRedirect'
import "cal-sans";
import { ThemeProvider } from './ThemeProvider'
import { Toaster } from 'sonner'
import { FullPageLoader } from './components/layout/Loaders'
import { useStickyState } from './hooks/useStickyState'


Expand Down Expand Up @@ -80,7 +79,7 @@ function App() {
accentColor='iris'
panelBackground='translucent'
toggleTheme={toggleTheme}>
<RouterProvider router={router} fallbackElement={<FullPageLoader className='w-screen' />} />
<RouterProvider router={router} />
</ThemeProvider>
</UserProvider>
</FrappeProvider>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ export const RetractVote = ({ message }: RetractVoteProps) => {
'message_id': message?.name,
}, `poll_data_${message?.poll_id}`, {
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: false
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ export const PollMessageBlock = ({ message, user, ...props }: PollMessageBlockPr
'message_id': message.name,
}, `poll_data_${message.poll_id}`, {
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: false
})

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,6 @@ export const LinkPreview = memo(({ messageID }: { messageID: string }) => {
const { data } = useFrappeGetCall<{ message: LinkPreviewDetails[] }>('raven.api.preview_links.get_preview_link', {
urls: JSON.stringify([href])
}, href ? `link_preview_${href}` : null, {
revalidateIfStale: false,
revalidateOnFocus: false,
revalidateOnReconnect: false,
shouldRetryOnError: false,
Expand Down
2 changes: 1 addition & 1 deletion raven-app/src/hooks/useCurrentRavenUser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ const useCurrentRavenUser = () => {
undefined,
'my_profile',
{
revalidateIfStale: false,
// revalidateIfStale: false,
revalidateOnFocus: false,
shouldRetryOnError: false,
revalidateOnReconnect: true
Expand Down
1 change: 0 additions & 1 deletion raven-app/src/hooks/useUnreadMessageCount.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ const useUnreadMessageCount = () => {
undefined,
'unread_channel_count', {
revalidateOnFocus: false,
revalidateIfStale: false,
revalidateOnReconnect: true,
})

Expand Down
2 changes: 1 addition & 1 deletion raven-app/src/pages/auth/Login.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export const Component = () => {
const { data: loginContext, mutate } = useFrappeGetCall<LoginContext>('raven.api.login.get_context', {
"redirect-to": "/raven"
}, 'raven.api.login.get_context', {
revalidateIfStale: false,
revalidateOnMount: true,
revalidateOnReconnect: false,
revalidateOnFocus: false
})
Expand Down
1 change: 0 additions & 1 deletion raven-app/src/utils/channel/ChannelListProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ export const useFetchChannelList = (): ChannelListContextType => {
hide_archived: false
}, `channel_list`, {
revalidateOnFocus: false,
revalidateIfStale: false,
onError: (error) => {
toast.error("There was an error while fetching the channel list.", {
description: getErrorMessage(error)
Expand Down
1 change: 0 additions & 1 deletion raven-app/src/utils/channel/ChannelMembersProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,6 @@ const useFetchChannelMembers = (channelID: string): ChannelMembersContextType |
}, `raven.api.chat.get_channel_members:${channelID}`, {
revalidateOnFocus: false,
revalidateOnReconnect: false,
revalidateIfStale: false
})

return {
Expand Down

0 comments on commit 334159f

Please sign in to comment.