Conversation
|
Continuous integration check(s) failed. Please review the failing check's logs and make the necessary changes. |
There was a problem hiding this comment.
Pull request overview
Refactors preset handling on the frontend to use a new Solid collection instead of storing presets on the legacy snapshot object. This fits the ongoing Solid migration by moving preset reads/writes onto reactive collection APIs.
Changes:
- Adds a new
collections/presets.tscollection with live query + optimistic add/edit/delete actions. - Updates settings, preset modal, preset controller, and command-line preset list to read from the new collection.
- Removes preset data/types from the legacy snapshot initialization path.
Reviewed changes
Copilot reviewed 7 out of 7 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
frontend/src/ts/pages/settings.ts |
Swaps preset rendering to collection-backed data and live updates. |
frontend/src/ts/modals/edit-preset.ts |
Replaces direct API/snapshot preset mutations with collection actions. |
frontend/src/ts/db.ts |
Seeds presets into the new collection during snapshot init. |
frontend/src/ts/controllers/preset-controller.ts |
Applies presets from the new collection API. |
frontend/src/ts/constants/default-snapshot.ts |
Removes preset storage/type from snapshot. |
frontend/src/ts/commandline/lists/presets.ts |
Reads command-line preset list from the collection. |
frontend/src/ts/collections/presets.ts |
Introduces the new preset collection and optimistic mutations. |
| __nonReactivePresets.getPresets().forEach((preset) => { | ||
| presetsEl?.appendHtml(` | ||
| <div class="buttons preset" data-id="${preset._id}" data-name="${preset.name}" data-display="${preset.display}"> | ||
| <div class="buttons preset" data-id="${preset._id}" data-name="${preset.name}"> |
| const presetItems = presets.map(toPresetItem); | ||
|
|
||
| presetsCollection.utils.writeBatch(() => { |
There was a problem hiding this comment.
logout clears the presetsCollection
| } | ||
|
|
||
| // oxlint-disable-next-line typescript/explicit-function-return-type | ||
| export function usePresetsLiveQuery() { |
There was a problem hiding this comment.
should we rename to ConfigPresets for more clarity? We have FilterPresets as well
| function toPresetItem(preset: Preset): PresetItem { | ||
| return { | ||
| ...preset, | ||
| display: preset.name.replaceAll("_", " "), |
There was a problem hiding this comment.
should we do the same as with tags? update the name to be without underscores, only convert when talking to the api?
| addPreset: createOptimisticAction<ActionType["addPreset"]>({ | ||
| onMutate: ({ name, config, settingGroups }) => { | ||
| presetsCollection.insert({ | ||
| _id: "temp-" + Date.now(), |
No description provided.