Skip to content

Commit

Permalink
fix(frontend): call mutate after changing public settings (#1302)
Browse files Browse the repository at this point in the history
  • Loading branch information
TheCatLady committed Mar 27, 2021
1 parent bec1d3d commit c8f67cf
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/components/Settings/SettingsMain.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { Field, Form, Formik } from 'formik';
import React, { useMemo } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { useToasts } from 'react-toast-notifications';
import useSWR from 'swr';
import useSWR, { mutate } from 'swr';
import * as Yup from 'yup';
import type { Language, MainSettings } from '../../../server/lib/settings';
import { Permission, useUser } from '../../hooks/useUser';
Expand Down Expand Up @@ -162,6 +162,7 @@ const SettingsMain: React.FC = () => {
trustProxy: values.trustProxy,
cacheImages: values.cacheImages,
});
mutate('/api/v1/settings/public');

addToast(intl.formatMessage(messages.toastSettingsSuccess), {
autoDismiss: true,
Expand Down
5 changes: 4 additions & 1 deletion src/components/Settings/SettingsServices.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import axios from 'axios';
import React, { useState } from 'react';
import { defineMessages, useIntl } from 'react-intl';
import useSWR from 'swr';
import useSWR, { mutate } from 'swr';
import type {
RadarrSettings,
SonarrSettings,
Expand Down Expand Up @@ -213,6 +213,7 @@ const SettingsServices: React.FC = () => {
setDeleteServerModal({ open: false, serverId: null, type: 'radarr' });
revalidateRadarr();
revalidateSonarr();
mutate('/api/v1/settings/public');
};

return (
Expand All @@ -237,6 +238,7 @@ const SettingsServices: React.FC = () => {
onClose={() => setEditRadarrModal({ open: false, radarr: null })}
onSave={() => {
revalidateRadarr();
mutate('/api/v1/settings/public');
setEditRadarrModal({ open: false, radarr: null });
}}
/>
Expand All @@ -247,6 +249,7 @@ const SettingsServices: React.FC = () => {
onClose={() => setEditSonarrModal({ open: false, sonarr: null })}
onSave={() => {
revalidateSonarr();
mutate('/api/v1/settings/public');
setEditSonarrModal({ open: false, sonarr: null });
}}
/>
Expand Down

0 comments on commit c8f67cf

Please sign in to comment.