mirror of
https://github.com/Comfy-Org/ComfyUI_frontend.git
synced 2026-01-26 19:09:52 +00:00
This pull request adds persistent filter and sort settings to the template library, allowing users' filter choices and sort preferences to be saved and restored across sessions. The main changes include integrating the settings store with the template filtering composable, updating the schema and core settings, and ensuring filter changes are saved efficiently. **Template Library Filter Persistence:** * [`src/composables/useTemplateFiltering.ts`](diffhunk://#diff-a1ec9d65962033526942cbcabeac8538ef3cd723e2e9e889cf668ccf6270d167L1-R32): The filter state (`selectedModels`, `selectedUseCases`, `selectedRunsOn`, and `sortBy`) is now initialized from the settings store and changes are persisted back using debounced watchers. This ensures user preferences are saved and restored. [[1]](diffhunk://#diff-a1ec9d65962033526942cbcabeac8538ef3cd723e2e9e889cf668ccf6270d167L1-R32) [[2]](diffhunk://#diff-a1ec9d65962033526942cbcabeac8538ef3cd723e2e9e889cf668ccf6270d167R259-R291) * [`src/platform/settings/constants/coreSettings.ts`](diffhunk://#diff-9fb7e2cdcdc60a92bdb54698fb49909bd2a84a50ffb69e2b60529a948eeb9756R1056-R1083): Added new hidden settings for template filter selections and sort preference, with sensible defaults. * [`src/schemas/apiSchema.ts`](diffhunk://#diff-b769532e74f826ca909951c0c34331b9246efb3f6901ff95a856ecf01ad826beR504-R514): Updated the settings schema to include the new template filter and sort settings, ensuring type safety and validation. **Default Behavior Adjustment:** * [`src/composables/useTemplateFiltering.ts`](diffhunk://#diff-a1ec9d65962033526942cbcabeac8538ef3cd723e2e9e889cf668ccf6270d167L200-R209): Changed the default sort order when clearing filters to `'newest'` to match the new default in settings. https://github.com/user-attachments/assets/259e87e6-20b3-4c91-b1bf-4b7d70649878 ┆Issue is synchronized with this [Notion page](https://www.notion.so/PR-6657-Persist-template-filters-2a86d73d3650818ca46fda23a6528391) by [Unito](https://www.unito.io)