mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-04-29 10:42:44 +00:00
Use store to manage nodeSearchService (#214)
This commit is contained in:
15
src/App.vue
15
src/App.vue
@@ -13,20 +13,16 @@
|
||||
</template>
|
||||
|
||||
<script setup lang="ts">
|
||||
import { computed, onMounted, onUnmounted, provide, ref, watch } from "vue";
|
||||
import { computed, onMounted, ref, watch } from "vue";
|
||||
import NodeSearchboxPopover from "@/components/NodeSearchBoxPopover.vue";
|
||||
import SideToolBar from "@/components/sidebar/SideToolBar.vue";
|
||||
import LiteGraphCanvasSplitterOverlay from "@/components/LiteGraphCanvasSplitterOverlay.vue";
|
||||
import ProgressSpinner from "primevue/progressspinner";
|
||||
import { NodeSearchService } from "./services/nodeSearchService";
|
||||
import { app } from "./scripts/app";
|
||||
import { useSettingStore } from "./stores/settingStore";
|
||||
import { useNodeDefStore } from "./stores/nodeDefStore";
|
||||
|
||||
const isLoading = ref(true);
|
||||
const nodeSearchService = computed(
|
||||
() => new NodeSearchService(useNodeDefStore().nodeDefs)
|
||||
);
|
||||
const nodeSearchEnabled = computed<boolean>(
|
||||
() => useSettingStore().get("Comfy.NodeSearchBoxImpl") === "default"
|
||||
);
|
||||
@@ -47,22 +43,21 @@ watch(
|
||||
{ immediate: true }
|
||||
);
|
||||
|
||||
const init = async () => {
|
||||
const init = () => {
|
||||
useNodeDefStore().addNodeDefs(Object.values(app.nodeDefs));
|
||||
useSettingStore().addSettings(app.ui.settings);
|
||||
app.vueAppReady = true;
|
||||
};
|
||||
|
||||
onMounted(async () => {
|
||||
onMounted(() => {
|
||||
try {
|
||||
await init();
|
||||
init();
|
||||
} catch (e) {
|
||||
console.error("Failed to init Vue app", e);
|
||||
} finally {
|
||||
isLoading.value = false;
|
||||
}
|
||||
});
|
||||
|
||||
provide("nodeSearchService", nodeSearchService);
|
||||
</script>
|
||||
|
||||
<style scoped>
|
||||
|
||||
Reference in New Issue
Block a user