1
Fork 0
mirror of https://github.com/Steffo99/festa.git synced 2024-10-16 06:57:26 +00:00

Disable revalidation while editing

This commit is contained in:
Steffo 2022-07-20 12:29:07 +02:00
parent 486050587f
commit ff73ab681f
Signed by: steffo
GPG key ID: 6965406171929D01

View file

@ -42,9 +42,9 @@ const PageEvent: NextPage<PageEventProps> = ({ slug, fallbackData }) => {
const { t } = useTranslation()
const axios = useAxios()
const { data, mutate } = useSWR<Event>(`/api/events/${slug}`, { fallbackData })
const [auth,] = useDefinedContext(AuthContext)
const [eventEditing, eventSetEditing] = useState<boolean>(false)
const { data, mutate } = useSWR<Event>(`/api/events/${slug}`, { fallbackData, revalidateOnFocus: eventEditing, revalidateOnReconnect: eventEditing, refreshInterval: eventEditing ? 0 : 30000 })
const [auth,] = useDefinedContext(AuthContext)
const save = useCallback(
async () => {