mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-02-22 07:44:11 +00:00
feat: add dynamic Fuse.js options loading for template filtering (#7822)
## Summary PRD: https://www.notion.so/comfy-org/Implement-Move-search-config-to-templates-repo-for-template-owner-adjustability-2c76d73d365081ad81c4ed33332eda09 Move search config to templates repo for template owner adjustability ## Changes - **What**: - Made `fuseOptions` reactive in `useTemplateFiltering` composable to support dynamic updates - Added `getFuseOptions()` API method to fetch Fuse.js configuration from `/templates/fuse_options.json` - Added `loadFuseOptions()` function to `useTemplateFiltering` that fetches and applies server-provided options - Removed unused `templateFuse` computed property from `workflowTemplatesStore` - Added comprehensive unit tests covering success, null response, error handling, and Fuse instance recreation scenarios - **Breaking**: None - **Dependencies**: None (uses existing `fuse.js` and `axios` dependencies) ## Review Focus - Verify that the API endpoint path `/templates/fuse_options.json` is correct and accessible - Confirm that the reactive `fuseOptions` properly triggers Fuse instance recreation when updated - Check that error handling gracefully falls back to default options when server fetch fails - Ensure the watch on `fuseOptions` is necessary or can be removed (currently just recreates Fuse via computed) - Review test coverage to ensure all edge cases are handled ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-7822-feat-add-dynamic-Fuse-js-options-loading-for-template-filtering-2db6d73d365081828103d8ee70844b2e) by [Unito](https://www.unito.io) --------- Co-authored-by: GitHub Action <action@github.com>
This commit is contained in:
@@ -563,7 +563,8 @@ const {
|
||||
availableRunsOn,
|
||||
filteredCount,
|
||||
totalCount,
|
||||
resetFilters
|
||||
resetFilters,
|
||||
loadFuseOptions
|
||||
} = useTemplateFiltering(navigationFilteredTemplates)
|
||||
|
||||
/**
|
||||
@@ -815,10 +816,10 @@ const pageTitle = computed(() => {
|
||||
// Initialize templates loading with useAsyncState
|
||||
const { isLoading } = useAsyncState(
|
||||
async () => {
|
||||
// Run all operations in parallel for better performance
|
||||
await Promise.all([
|
||||
loadTemplates(),
|
||||
workflowTemplatesStore.loadWorkflowTemplates()
|
||||
workflowTemplatesStore.loadWorkflowTemplates(),
|
||||
loadFuseOptions()
|
||||
])
|
||||
return true
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user