Skip to content

A local-first personal finance app

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

Jed Fox2c7b814d376e
diff --git a/packages/desktop-client/src/components/settings/Reset.js b/packages/desktop-client/src/components/settings/Reset.js
index f17383cb45..16307b4160 100644
--- a/packages/desktop-client/src/components/settings/Reset.js
+++ b/packages/desktop-client/src/components/settings/Reset.js
@@ -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>
);
}
diff --git a/packages/desktop-client/src/components/settings/index.js b/packages/desktop-client/src/components/settings/index.js
index c56f0775e4..85b9fbf8c3 100644
--- a/packages/desktop-client/src/components/settings/index.js
+++ b/packages/desktop-client/src/components/settings/index.js
@@ -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>
diff --git a/upcoming-release-notes/1104.md b/upcoming-release-notes/1104.md
new file mode 100644
index 0000000000..5baf9c273e
--- /dev/null
+++ b/upcoming-release-notes/1104.md
@@ -0,0 +1,6 @@
+---
+category: Enhancements
+authors: [j-f1]
+---
+
+Disable “Reset sync” button when sync is disabled