Skip to content

Commit

Permalink
🚚 Move config init to HomeView
Browse files Browse the repository at this point in the history
  • Loading branch information
huchenlei committed Sep 2, 2023
1 parent 1cd944f commit 41ecf0f
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
1 change: 0 additions & 1 deletion src/views/ConfigView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,6 @@ import { type StateDiff, stateDiffToAppState, appStateToStateDiff } from '@/Conf
import _ from 'lodash';
const store = useConfigStore();
store.initializeConfigEntries();
const allConfigOptions = computed(() => Object.keys(store.configEntries).map(configName => {
return {
Expand Down
11 changes: 9 additions & 2 deletions src/views/HomeView.vue
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ import { ref, onMounted, getCurrentInstance } from 'vue';
import { useA1111ContextStore } from '@/stores/a1111ContextStore';
import { useRouter } from 'vue-router';
import { DeleteOutlined } from '@ant-design/icons-vue';
import { useConfigStore } from '@/stores/configStore';
import { useAppStateStore } from '@/stores/appStateStore';
const { $notify } = getCurrentInstance()!.appContext.config.globalProperties;
interface ConnectionItem {
Expand All @@ -15,13 +17,18 @@ let connectionHistory = ref<ConnectionItem[]>([]);
const store = useA1111ContextStore();
const router = useRouter();
// Load connection history from localStorage
onMounted(() => {
onMounted(async () => {
// Load connection history from localStorage
const savedHistory = localStorage.getItem('connectionHistory');
if (savedHistory) {
connectionHistory.value = JSON.parse(savedHistory).sort(
(a: ConnectionItem, b: ConnectionItem) => b.timestamp - a.timestamp);
}
// Initialize configs.
await useConfigStore().initializeConfigEntries()
await useAppStateStore().resetToDefault();
});
async function initializeContext(url: string) {
Expand Down

0 comments on commit 41ecf0f

Please sign in to comment.