diff --git a/neode-ui/src/components/LightningChannelsPanel.vue b/neode-ui/src/components/LightningChannelsPanel.vue index 696218a0..6597aac8 100644 --- a/neode-ui/src/components/LightningChannelsPanel.vue +++ b/neode-ui/src/components/LightningChannelsPanel.vue @@ -474,9 +474,9 @@ const channelsRes = useCachedResource({ method: 'lnd.listchannels', timeout: 15000, signal, dedup: true, maxRetries: 1, }) return { - channels: result.channels || [], - total_inbound: result.total_inbound || 0, - total_outbound: result.total_outbound || 0, + channels: result?.channels || [], + total_inbound: result?.total_inbound || 0, + total_outbound: result?.total_outbound || 0, } }, }) @@ -486,7 +486,7 @@ const closedRes = useCachedResource({ const closed = await rpcClient.call<{ channels: ClosedChannel[] }>({ method: 'lnd.closedchannels', timeout: 15000, signal, dedup: true, maxRetries: 1, }) - return closed.channels || [] + return closed?.channels || [] }, }) const loading = computed(() => @@ -570,8 +570,9 @@ function capacityPercent(amount: number, capacity: number): number { } function loadChannels(): Promise { + const main = channelsRes.refresh() void closedRes.refresh() - return channelsRes.refresh() + return main } function feeParams(): { target_conf?: number; sat_per_vbyte?: number } | null { diff --git a/neode-ui/src/views/__tests__/PeerFilesRefresh.test.ts b/neode-ui/src/views/__tests__/PeerFilesRefresh.test.ts index 1c9ce24d..21277387 100644 --- a/neode-ui/src/views/__tests__/PeerFilesRefresh.test.ts +++ b/neode-ui/src/views/__tests__/PeerFilesRefresh.test.ts @@ -1,5 +1,6 @@ import { flushPromises, mount } from '@vue/test-utils' import { describe, expect, it, vi } from 'vitest' +import { createPinia } from 'pinia' import PeerFiles from '../PeerFiles.vue' import { rpcClient } from '@/api/rpc-client' @@ -55,6 +56,8 @@ describe('PeerFiles', () => { const wrapper = mount(PeerFiles, { props: { peerId: 'peer.onion' }, global: { + // The shared peer-browse cache lives in the Pinia resources store. + plugins: [createPinia()], stubs: { Teleport: true, }, diff --git a/neode-ui/src/views/__tests__/ServerNetworkRefresh.test.ts b/neode-ui/src/views/__tests__/ServerNetworkRefresh.test.ts index eed224b1..6f00e44a 100644 --- a/neode-ui/src/views/__tests__/ServerNetworkRefresh.test.ts +++ b/neode-ui/src/views/__tests__/ServerNetworkRefresh.test.ts @@ -1,5 +1,6 @@ import { flushPromises, mount } from '@vue/test-utils' import { describe, expect, it, vi } from 'vitest' +import { createPinia } from 'pinia' import Server from '../Server.vue' import { rpcClient } from '@/api/rpc-client' @@ -29,6 +30,8 @@ function deferred() { function mountServer(options: { renderTorServices?: boolean } = {}) { return mount(Server, { global: { + // The cached-resource layer pulls the Pinia resources store in setup. + plugins: [createPinia()], stubs: { QuickActionsCard: true, TorServicesCard: options.renderTorServices ? false : true,