From 705cb7d9bc5cb7fe61f7c92a8e3eaa4773bf6833 Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Sat, 31 Jan 2026 10:01:34 +0530
Subject: [PATCH 1/2] fix: show toast for infinite duration
---
.../ERPNextSyncSettings.ts | 6 ++
src/components/Toast.vue | 59 ++++++++++++++-----
src/utils/ui.ts | 6 +-
3 files changed, 55 insertions(+), 16 deletions(-)
diff --git a/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
index b1899350..de878811 100644
--- a/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
+++ b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
@@ -43,6 +43,12 @@ export class ERPNextSyncSettings extends Doc {
async change(ch: ChangeArg) {
if (ch.changed === 'syncDataFromServer') {
+ const { showToast } = await import('src/utils/interactive');
+ showToast({
+ type: 'warning',
+ message: 'Fetching data from server.',
+ duration: 'very_long'
+ });
await initERPNSync(this.fyo);
ipc.reloadWindow();
} else if (ch.changed === 'syncDataToServer') {
diff --git a/src/components/Toast.vue b/src/components/Toast.vue
index 0c006396..6b2ffd61 100644
--- a/src/components/Toast.vue
+++ b/src/components/Toast.vue
@@ -42,20 +42,44 @@
{{ actionText }}
-
+
@@ -87,11 +111,16 @@ export default defineComponent({
config() {
return getIconConfig(this.type);
},
+ isPersistent() {
+ return this.duration === 'very_long';
+ },
},
async mounted() {
const duration = toastDurationMap[this.duration];
await nextTick(() => (this.open = true));
- setTimeout(this.closeToast, duration);
+ if (duration !== Infinity) {
+ setTimeout(this.closeToast, duration);
+ }
},
methods: {
actionClicked() {
diff --git a/src/utils/ui.ts b/src/utils/ui.ts
index 3c735bd9..10273cf2 100644
--- a/src/utils/ui.ts
+++ b/src/utils/ui.ts
@@ -37,7 +37,11 @@ import {
UIGroupedFields,
} from './types';
-export const toastDurationMap = { short: 2_500, long: 5_000 } as const;
+export const toastDurationMap = {
+ short: 2_500,
+ long: 5_000,
+ very_long: Infinity,
+} as const;
export async function openQuickEdit({
doc,
From 8431c573fe8a7e5c314eb1173179be1287885f35 Mon Sep 17 00:00:00 2001
From: AbleKSaju <126228406+AbleKSaju@users.noreply.github.com>
Date: Sat, 31 Jan 2026 10:05:40 +0530
Subject: [PATCH 2/2] fix: formatted
---
models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
index de878811..9e4a3bd4 100644
--- a/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
+++ b/models/baseModels/ERPNextSyncSettings/ERPNextSyncSettings.ts
@@ -47,7 +47,7 @@ export class ERPNextSyncSettings extends Doc {
showToast({
type: 'warning',
message: 'Fetching data from server.',
- duration: 'very_long'
+ duration: 'very_long',
});
await initERPNSync(this.fyo);
ipc.reloadWindow();