Skip to content

Commit 6d7ef94

Browse files
committed
Load proxies only when visiting the proxy view
1 parent 13dfc67 commit 6d7ef94

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

src/popup/App.vue

+1-10
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,15 @@
11
<script lang="ts" setup>
2-
import { provide, onMounted } from 'vue';
2+
import { provide } from 'vue';
33
import { useQueryProvider } from 'vue-query';
44
import { NConfigProvider, GlobalThemeOverrides, darkTheme } from 'naive-ui';
55
66
import Popup from '@/popup/Popup.vue';
7-
87
import useConnection, { ConnectionKey } from '@/composables/useConnection';
9-
import useListProxies from '@/composables/useListProxies';
108
119
const { isLoading, connection, isError } = useConnection();
12-
const { getSocksProxies } = useListProxies();
1310
1411
provide(ConnectionKey, { connection, isLoading, isError });
1512
16-
const loadProxies = async () => {
17-
await getSocksProxies();
18-
};
19-
20-
onMounted(loadProxies);
21-
2213
useQueryProvider();
2314
const themeOverrides: GlobalThemeOverrides = {
2415
common: {

src/popup/views/Proxy.vue

+10-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<script lang="ts" setup>
2-
import { computed, inject } from 'vue';
2+
import { computed, inject, onMounted } from 'vue';
33
44
import IconLabel from '@/components/IconLabel.vue';
55
import LocationDrawer from '@/components/ConnectionDetails/LocationDrawer.vue';
@@ -8,15 +8,24 @@ import ProxyHost from '@/components/Proxy/ProxyHost.vue';
88
99
import useActiveTab from '@/composables/useActiveTab';
1010
import { ConnectionKey, defaultConnection } from '@/composables/useConnection';
11+
import useListProxies from '@/composables/useListProxies';
1112
1213
const { isAboutPage } = useActiveTab();
14+
const { getSocksProxies } = useListProxies();
15+
1316
const { connection } = inject(ConnectionKey, defaultConnection);
1417
1518
const isWireGuard = computed(
1619
() =>
1720
connection.value.protocol === 'WireGuard' ||
1821
connection.value.protocol === 'SOCKS through WireGuard',
1922
);
23+
24+
const loadProxies = async () => {
25+
await getSocksProxies();
26+
};
27+
28+
onMounted(loadProxies);
2029
</script>
2130

2231
<template>

0 commit comments

Comments
 (0)