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() {
);
}
export function ResetSync({ resetSync }) {
export function ResetSync({ isEnabled, resetSync }) {
let [resetting, setResetting] = useState(false);
async function onResetSync() {
......@@ -46,17 +46,28 @@ export function ResetSync({ resetSync }) {
return (
<Setting
primaryAction={
<ButtonWithLoading loading={resetting} onClick={onResetSync}>
<ButtonWithLoading
loading={resetting}
disabled={!isEnabled}
onClick={onResetSync}
>
Reset sync
</ButtonWithLoading>
}
>
<Text>
<strong>Reset sync</strong> will remove all local data used to track
changes for syncing, and create a fresh sync ID on the server. This file
on other devices will have to be re-downloaded to use the new sync ID.
Use this if there is a problem with syncing and you want to start fresh.
</Text>
{isEnabled ? (
<Text>
<strong>Reset sync</strong> will remove all local data used to track
changes for syncing, and create a fresh sync ID on the server. This
file on other devices will have to be re-downloaded to use the new
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>
);
}
......@@ -176,7 +176,7 @@ function Settings({
<AdvancedToggle>
<AdvancedAbout prefs={prefs} />
<ResetCache />
<ResetSync resetSync={resetSync} />
<ResetSync isEnabled={!!prefs.groupId} resetSync={resetSync} />
<FixSplitsTool />
<ExperimentalFeatures prefs={prefs} savePrefs={savePrefs} />
</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