Refresh journal/general ledger view when transaction updated
This commit is contained in:
parent
62b7981224
commit
b3defb562f
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
DrCr: Web-based double-entry bookkeeping framework
|
DrCr: Web-based double-entry bookkeeping framework
|
||||||
Copyright (C) 2022–2025 Lee Yingtong Li (RunasSudo)
|
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -63,6 +63,7 @@
|
|||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
import { PencilIcon, PlusIcon } from '@heroicons/vue/24/outline';
|
import { PencilIcon, PlusIcon } from '@heroicons/vue/24/outline';
|
||||||
import { invoke } from '@tauri-apps/api/core';
|
import { invoke } from '@tauri-apps/api/core';
|
||||||
|
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||||
import { onUnmounted, ref, watch } from 'vue';
|
import { onUnmounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { Transaction } from '../db.ts';
|
import { Transaction } from '../db.ts';
|
||||||
@ -151,9 +152,20 @@
|
|||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
// Refresh transaction list when transaction updated
|
||||||
|
let unlistenTransactionUpdated: UnlistenFn | null = null;
|
||||||
|
(async () => {
|
||||||
|
// Cannot await at top level without <Suspense> therefore do this in an async function
|
||||||
|
unlistenTransactionUpdated = await listen('transaction-updated', async (_event) => { await load(); });
|
||||||
|
})();
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (clusterize !== null) {
|
if (clusterize !== null) {
|
||||||
clusterize.destroy();
|
clusterize.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlistenTransactionUpdated !== null) {
|
||||||
|
unlistenTransactionUpdated();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
<!--
|
<!--
|
||||||
DrCr: Web-based double-entry bookkeeping framework
|
DrCr: Web-based double-entry bookkeeping framework
|
||||||
Copyright (C) 2022–2025 Lee Yingtong Li (RunasSudo)
|
Copyright (C) 2022-2025 Lee Yingtong Li (RunasSudo)
|
||||||
|
|
||||||
This program is free software: you can redistribute it and/or modify
|
This program is free software: you can redistribute it and/or modify
|
||||||
it under the terms of the GNU Affero General Public License as published by
|
it under the terms of the GNU Affero General Public License as published by
|
||||||
@ -60,12 +60,10 @@
|
|||||||
|
|
||||||
<script setup lang="ts">
|
<script setup lang="ts">
|
||||||
import Clusterize from 'clusterize.js';
|
import Clusterize from 'clusterize.js';
|
||||||
|
|
||||||
import dayjs from 'dayjs';
|
import dayjs from 'dayjs';
|
||||||
|
|
||||||
import { PencilIcon } from '@heroicons/vue/24/outline';
|
import { PencilIcon } from '@heroicons/vue/24/outline';
|
||||||
import { PlusIcon } from '@heroicons/vue/16/solid';
|
import { PlusIcon } from '@heroicons/vue/16/solid';
|
||||||
|
import { UnlistenFn, listen } from '@tauri-apps/api/event';
|
||||||
import { onUnmounted, ref, watch } from 'vue';
|
import { onUnmounted, ref, watch } from 'vue';
|
||||||
|
|
||||||
import { JoinedTransactionPosting, Transaction, db, joinedToTransactions } from '../db.ts';
|
import { JoinedTransactionPosting, Transaction, db, joinedToTransactions } from '../db.ts';
|
||||||
@ -157,9 +155,20 @@
|
|||||||
|
|
||||||
load();
|
load();
|
||||||
|
|
||||||
|
// Refresh transaction list when transaction updated
|
||||||
|
let unlistenTransactionUpdated: UnlistenFn | null = null;
|
||||||
|
(async () => {
|
||||||
|
// Cannot await at top level without <Suspense> therefore do this in an async function
|
||||||
|
unlistenTransactionUpdated = await listen('transaction-updated', async (_event) => { await load(); });
|
||||||
|
})();
|
||||||
|
|
||||||
onUnmounted(() => {
|
onUnmounted(() => {
|
||||||
if (clusterize !== null) {
|
if (clusterize !== null) {
|
||||||
clusterize.destroy();
|
clusterize.destroy();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (unlistenTransactionUpdated !== null) {
|
||||||
|
unlistenTransactionUpdated();
|
||||||
|
}
|
||||||
});
|
});
|
||||||
</script>
|
</script>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user