Skip to content
Snippets Groups Projects
Unverified Commit 2c7b814d authored by Jed Fox's avatar Jed Fox Committed by GitHub
Browse files

Disable “Reset sync” button when sync is disabled (#1104)

Extracted from #984
parent e1f7262f
No related branches found
No related tags found
No related merge requests found
...@@ -34,7 +34,7 @@ export function ResetCache() { ...@@ -34,7 +34,7 @@ export function ResetCache() {
); );
} }
export function ResetSync({ resetSync }) { export function ResetSync({ isEnabled, resetSync }) {
let [resetting, setResetting] = useState(false); let [resetting, setResetting] = useState(false);
async function onResetSync() { async function onResetSync() {
...@@ -46,17 +46,28 @@ export function ResetSync({ resetSync }) { ...@@ -46,17 +46,28 @@ export function ResetSync({ resetSync }) {
return ( return (
<Setting <Setting
primaryAction={ primaryAction={
<ButtonWithLoading loading={resetting} onClick={onResetSync}> <ButtonWithLoading
loading={resetting}
disabled={!isEnabled}
onClick={onResetSync}
>
Reset sync Reset sync
</ButtonWithLoading> </ButtonWithLoading>
} }
> >
<Text> {isEnabled ? (
<strong>Reset sync</strong> will remove all local data used to track <Text>
changes for syncing, and create a fresh sync ID on the server. This file <strong>Reset sync</strong> will remove all local data used to track
on other devices will have to be re-downloaded to use the new sync ID. changes for syncing, and create a fresh sync ID on the server. This
Use this if there is a problem with syncing and you want to start fresh. file on other devices will have to be re-downloaded to use the new
</Text> sync ID. Use this if there is a problem with syncing and you want to
start fresh.
</Text>
) : (
<Text>
<strong>Reset sync</strong> is only available when syncing is enabled.
</Text>
)}
</Setting> </Setting>
); );
} }
...@@ -176,7 +176,7 @@ function Settings({ ...@@ -176,7 +176,7 @@ function Settings({
<AdvancedToggle> <AdvancedToggle>
<AdvancedAbout prefs={prefs} /> <AdvancedAbout prefs={prefs} />
<ResetCache /> <ResetCache />
<ResetSync resetSync={resetSync} /> <ResetSync isEnabled={!!prefs.groupId} resetSync={resetSync} />
<FixSplitsTool /> <FixSplitsTool />
<ExperimentalFeatures prefs={prefs} savePrefs={savePrefs} /> <ExperimentalFeatures prefs={prefs} savePrefs={savePrefs} />
</AdvancedToggle> </AdvancedToggle>
......
---
category: Enhancements
authors: [j-f1]
---
Disable “Reset sync” button when sync is disabled
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment