Skip to content

Commit e9f0e55

Browse files
committed
Load proxies only when visiting the proxy view
1 parent c72ca2b commit e9f0e55

File tree

2 files changed

+12
-12
lines changed

2 files changed

+12
-12
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

+11-2
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
import { NCard } from 'naive-ui';
44
55
import Button from '@/components/Buttons/Button.vue';
@@ -11,17 +11,26 @@ import TitleCategory from '@/components/TitleCategory.vue';
1111
1212
import useActiveTab from '@/composables/useActiveTab';
1313
import { ConnectionKey, defaultConnection } from '@/composables/useConnection';
14+
import useListProxies from '@/composables/useListProxies';
1415
import useProxyPermissions from '@/composables/useProxyPermissions';
1516
16-
const { proxyPermissionsGranted, triggerProxyPermissions } = useProxyPermissions();
1717
const { isAboutPage } = useActiveTab();
18+
const { getSocksProxies } = useListProxies();
19+
const { proxyPermissionsGranted, triggerProxyPermissions } = useProxyPermissions();
20+
1821
const { connection } = inject(ConnectionKey, defaultConnection);
1922
2023
const isWireGuard = computed(
2124
() =>
2225
connection.value.protocol === 'WireGuard' ||
2326
connection.value.protocol === 'SOCKS through WireGuard',
2427
);
28+
29+
const loadProxies = async () => {
30+
await getSocksProxies();
31+
};
32+
33+
onMounted(loadProxies);
2534
</script>
2635

2736
<template>

0 commit comments

Comments
 (0)