π¨ The ultimate agentic social media scheduling tool π€
TypeScript nextjsopen-sourceopen-source-social-media-scheduling-toolosspostiz-cloudpostiz-hostedredisscheduling-toolsocial-media-scheduling-tooltypescript
feat: reduce server requests
Nevo David69082319a057
diff --git a/apps/frontend/src/components/autopost/autopost.tsx b/apps/frontend/src/components/autopost/autopost.tsxindex 21af46520..456ffbfd2 100644--- a/apps/frontend/src/components/autopost/autopost.tsx+++ b/apps/frontend/src/components/autopost/autopost.tsx@@ -228,7 +228,14 @@ export const AddOrEditWebhook: FC<{},[]);- const { data: dataList, isLoading } = useSWR('integrations', integration);+ const { data: dataList, isLoading } = useSWR('integrations', integration, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const callBack = useCallback(async (values: any) => {await fetch(data?.id ? `/autopost/${data?.id}` : '/autopost', {diff --git a/apps/frontend/src/components/launches/calendar.context.tsx b/apps/frontend/src/components/launches/calendar.context.tsxindex 3272fd0c9..7ecdf006c 100644--- a/apps/frontend/src/components/launches/calendar.context.tsx+++ b/apps/frontend/src/components/launches/calendar.context.tsx@@ -176,8 +176,22 @@ export const CalendarWeekProvider: FC<{return (await fetch('/sets')).json();}, []);- const { data: sets, mutate } = useSWR('sets', setList);- const { data: sign } = useSWR('default-sign', defaultSign);+ const { data: sets, mutate } = useSWR('sets', setList, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });+ const { data: sign } = useSWR('default-sign', defaultSign, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const setFiltersWrapper = useCallback((filters: {diff --git a/apps/frontend/src/components/launches/helpers/use.integration.list.tsx b/apps/frontend/src/components/launches/helpers/use.integration.list.tsxindex 99acc5ee7..4e3d2a557 100644--- a/apps/frontend/src/components/launches/helpers/use.integration.list.tsx+++ b/apps/frontend/src/components/launches/helpers/use.integration.list.tsx@@ -12,6 +12,12 @@ export const useIntegrationList = () => {}, []);return useSWR('/integrations/list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});};\ No newline at end of filediff --git a/apps/frontend/src/components/launches/tags.component.tsx b/apps/frontend/src/components/launches/tags.component.tsxindex 2a21b857a..b7da39e4b 100644--- a/apps/frontend/src/components/launches/tags.component.tsx+++ b/apps/frontend/src/components/launches/tags.component.tsx@@ -32,7 +32,14 @@ export const TagsComponent: FC<{name: string;color: string;}[];- }>('tags', loadTags);+ }>('tags', loadTags, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const onDelete = useCallback((tagIndex: number) => {const modify = tagValue.filter((_, i) => i !== tagIndex);diff --git a/apps/frontend/src/components/layout/continue.provider.tsx b/apps/frontend/src/components/layout/continue.provider.tsxindex 7362af4d0..38a1fa7b9 100644--- a/apps/frontend/src/components/layout/continue.provider.tsx+++ b/apps/frontend/src/components/layout/continue.provider.tsx@@ -22,6 +22,12 @@ export const ContinueProvider: FC = () => {return list;}, []);const { data: integrations } = useSWR('/integrations/list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});const closeModal = useCallback(() => {diff --git a/apps/frontend/src/components/onboarding/connect.channels.tsx b/apps/frontend/src/components/onboarding/connect.channels.tsxindex fa749face..96ed0ea1c 100644--- a/apps/frontend/src/components/onboarding/connect.channels.tsx+++ b/apps/frontend/src/components/onboarding/connect.channels.tsx@@ -160,6 +160,12 @@ export const ConnectChannels: FC = () => {}, []);const { data: integrations, mutate } = useSWR('/integrations/list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});@@ -223,7 +229,10 @@ export const ConnectChannels: FC = () => {<div className="absolute w-full h-full top-0 start-0 z-[400]"><div className="absolute w-full h-full bg-primary/80 start-0 top-0 z-[200] p-[50px] flex justify-center"><div className="w-[400px]">- <ModalWrapperComponent title="" customClose={() => setShowCustom(undefined)}>+ <ModalWrapperComponent+ title=""+ customClose={() => setShowCustom(undefined)}+ >{showCustom}</ModalWrapperComponent></div>diff --git a/apps/frontend/src/components/platform-analytics/platform.analytics.tsx b/apps/frontend/src/components/platform-analytics/platform.analytics.tsxindex 83059ad48..12e2f8388 100644--- a/apps/frontend/src/components/platform-analytics/platform.analytics.tsx+++ b/apps/frontend/src/components/platform-analytics/platform.analytics.tsx@@ -51,6 +51,12 @@ export const PlatformAnalytics = () => {return int.filter((f: any) => allowedIntegrations.includes(f.identifier));}, []);const { data, isLoading } = useSWR('analytics-list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});const sortedIntegrations = useMemo(() => {diff --git a/apps/frontend/src/components/plugs/plugs.tsx b/apps/frontend/src/components/plugs/plugs.tsxindex 16338f163..ca9ae1807 100644--- a/apps/frontend/src/components/plugs/plugs.tsx+++ b/apps/frontend/src/components/plugs/plugs.tsx@@ -34,9 +34,21 @@ export const Plugs = () => {load2,{fallbackData: [],+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,});const { data, isLoading } = useSWR('analytics-list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});diff --git a/apps/frontend/src/components/sets/sets.tsx b/apps/frontend/src/components/sets/sets.tsxindex b088e0687..c0b440e2b 100644--- a/apps/frontend/src/components/sets/sets.tsx+++ b/apps/frontend/src/components/sets/sets.tsx@@ -68,6 +68,12 @@ export const Sets: FC = () => {}, []);const { isLoading, data: integrations } = useSWR('/integrations/list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});@@ -75,7 +81,14 @@ export const Sets: FC = () => {return (await fetch('/sets')).json();}, []);- const { data, mutate } = useSWR('sets', list);+ const { data, mutate } = useSWR('sets', list, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const addSet = useCallback((params?: { id?: string; name?: string; content?: string }) => () => {diff --git a/apps/frontend/src/components/standalone-modal/standalone.modal.tsx b/apps/frontend/src/components/standalone-modal/standalone.modal.tsxindex da781301d..35a49da63 100644--- a/apps/frontend/src/components/standalone-modal/standalone.modal.tsx+++ b/apps/frontend/src/components/standalone-modal/standalone.modal.tsx@@ -27,6 +27,12 @@ export const StandaloneModal: FC = () => {data: integrations,mutate,} = useSWR('/integrations/list', load, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,fallbackData: [],});const { isLoading: isLoading2, data } = useSWR('/posts/find-slot', loadDate, {diff --git a/apps/frontend/src/components/third-parties/third-party.component.tsx b/apps/frontend/src/components/third-parties/third-party.component.tsxindex 9becc9cbb..e6f344bc9 100644--- a/apps/frontend/src/components/third-parties/third-party.component.tsx+++ b/apps/frontend/src/components/third-parties/third-party.component.tsx@@ -102,7 +102,14 @@ export const ThirdPartyComponent = () => {return (await fetch('/third-party')).json();}, []);- const { data, isLoading, mutate } = useSWR('third-party', integrations);+ const { data, isLoading, mutate } = useSWR('third-party', integrations, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const [collapseMenu, setCollapseMenu] = useCookie('collapseMenu', '0');return (@@ -141,7 +148,11 @@ export const ThirdPartyComponent = () => {</div><div className="flex flex-col gap-[10px]"><div className="flex-1 flex flex-col gap-[14px]">- <div className={clsx('gap-[16px] flex flex-col relative justify-center group/profile hover:bg-boxHover rounded-e-[8px]')}>+ <div+ className={clsx(+ 'gap-[16px] flex flex-col relative justify-center group/profile hover:bg-boxHover rounded-e-[8px]'+ )}+ >{!isLoading && !data?.length ? (<div>No Integrations Yet</div>) : (diff --git a/apps/frontend/src/components/third-parties/third-party.list.component.tsx b/apps/frontend/src/components/third-parties/third-party.list.component.tsxindex de95c9dd9..6e6d8ed27 100644--- a/apps/frontend/src/components/third-parties/third-party.list.component.tsx+++ b/apps/frontend/src/components/third-parties/third-party.list.component.tsx@@ -103,7 +103,14 @@ export const ThirdPartyListComponent: FC<{ reload: () => void }> = (props) => {return (await fetch('/third-party/list')).json();}, []);- const { data } = useSWR('third-party-list', integrationsList);+ const { data } = useSWR('third-party-list', integrationsList, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const addApiKey = useCallback((title: string, identifier: string) => () => {diff --git a/apps/frontend/src/components/third-parties/third-party.media.tsx b/apps/frontend/src/components/third-parties/third-party.media.tsxindex 0545c6279..e4a7d639d 100644--- a/apps/frontend/src/components/third-parties/third-party.media.tsx+++ b/apps/frontend/src/components/third-parties/third-party.media.tsx@@ -205,7 +205,14 @@ export const ThirdPartyMedia: FC<{);}, []);- const { data, isLoading, mutate } = useSWR('third-party', thirdParties);+ const { data, isLoading, mutate } = useSWR('third-party', thirdParties, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });if (isLoading || !data.length) {return null;diff --git a/apps/frontend/src/components/webhooks/webhooks.tsx b/apps/frontend/src/components/webhooks/webhooks.tsxindex 964982877..6f5d87a30 100644--- a/apps/frontend/src/components/webhooks/webhooks.tsx+++ b/apps/frontend/src/components/webhooks/webhooks.tsx@@ -164,7 +164,14 @@ export const AddOrEditWebhook: FC<{},[]);- const { data: dataList, isLoading } = useSWR('integrations', integration);+ const { data: dataList, isLoading } = useSWR('integrations', integration, {+ revalidateOnFocus: false,+ revalidateOnReconnect: false,+ revalidateIfStale: false,+ revalidateOnMount: true,+ refreshWhenHidden: false,+ refreshWhenOffline: false,+ });const callBack = useCallback(async (values: any) => {await fetch('/webhooks', {