Procházet zdrojové kódy

Profiles: the material type dropdown follows the preferred slicer (#2928) (#3544)

Keybored před 1 týdnem
rodič
revize
1a044820bc

+ 1 - 0
CHANGELOG.md

@@ -20,6 +20,7 @@ All notable changes to Bambuddy will be documented in this file.
 - **Cam Wall tiles show temperatures and finish time, and can pause, stop and switch the light (#3479, sponsor vote Q4 2026)** — With the **Full** status overlay, every connected tile shows its nozzle (both on a dual-nozzle printer), bed and chamber temperatures, and a printing tile adds its finish time beside the time left. Hovering over a tile shows **Pause/Resume** and **Stop**, with the same confirmations as the printer card, and a **chamber light** switch; **Tile controls: Always** in the wall settings keeps them on screen, and a touch screen always shows them. The controls need the `printers:control` permission; a user without it, an offline printer and a Cam Wall token (kiosk) wall get none.
 - **The H2C shows how long each nozzle has printed (#1908, contributed by @Keybored02 in #3507)** — Recent H2C firmware counts the print time of every nozzle, which says more about a nozzle's use than the wear estimate. Hovering over a nozzle on the printer card, in the nozzle rack or on the left and right hotend, now shows its **Print time** next to **Wear**. Firmware that does not report it, and other printers, show no print time. Wiki updated.
 
+- **The profile editor offers the material types of the preferred slicer (#2928, requested by @doncaruana, contributed by @Keybored02 in #3544)** — The **Filament Type** dropdown of a filament profile was one list kept in Bambuddy, with types a slicer does not know (and without ones it does), so a profile could be valid here and not in the slicer. It now offers the types of the slicer chosen under Settings → Slicer: Bambu Studio's or OrcaSlicer's, which differ (Orca has SBS and the PA11/PA12 families, Bambu Studio has TPU-AMS). A profile keeps the type it has, imported or cloud-synced, even if the list does not have it, and changing the preferred slicer changes no existing profile.
 ### Changed
 - **A slice sent again from the slicer adds a print to its archive (#1634, requested by @d3nn3s08, contributed by @Keybored02 in #3508)** — A print from the File Manager or the queue already joined the archive of its file, but a print sent from Bambu Studio or OrcaSlicer, or started on the printer, always got a new archive: the slicer writes a new 3MF each time it sends, so the file never matched, and the archive's print count stayed at one. Bambuddy now also keeps the hash of each archive's G-code, and a print whose G-code matches an archive nobody owns, in no project and not from a File Manager file adds a run to that archive. The archive takes the new 3MF in place of its old one and keeps its photos, timelapses, notes, tags and earlier runs; a name set by hand stays, and a name taken from the file follows the new file. While another print of it is running, the archive keeps its file and only gets the run. A model sliced again with other settings gets an archive of its own. OrcaSlicer writes the slicing time into the G-code, so with it only the same slice sent again matches. Archives made before are read once in the background after the update. Wiki updated.
 - **SpoolBuddy writes OpenTag3D 2.004 on NTAG215 and NTAG216 tags (#3500, suggested by @pleasantone)** — SpoolBuddy wrote the first version of the OpenTag3D layout. The current version moved every field, so a reader that only knows it read the brand, colour, weight and temperatures from the wrong places. Tags with room for it now get version 2.004, with material, brand, colour name, up to four colours, minimum and maximum print temperature, net weight and empty spool weight. Version 2 no longer fits on an NTAG213, so those keep the first version. SpoolBuddy picks by the size the tag reports, and falls back to the first version if it can't read it; a SpoolBuddy that hasn't been updated keeps writing the first version. Bambuddy does not track density or bed temperature, so a version 2 tag leaves them unset. Wiki updated.

+ 41 - 3
backend/app/api/routes/cloud.py

@@ -1312,6 +1312,40 @@ def _load_fields(preset_type: str) -> dict:
     return data
 
 
+def _with_slicer_material_types(data: dict, preferred_slicer: str | None) -> dict:
+    """The filament field definitions with the Material type dropdown of the preferred slicer (#2928).
+
+    The two slicers do not accept the same ``filament_type`` values (Orca has
+    SBS, Bambu Studio has TPU-AMS), so a profile made here starts from what the
+    slicer the user picked understands. A preferred slicer that is not set
+    counts as Bambu Studio, as everywhere else; one that is not known leaves the
+    list as the field file has it. Only this dropdown changes, and a profile's
+    own ``filament_type`` is never rewritten (the editor adds the value a profile
+    already has when it is not in the list).
+    """
+    if "slicer_filament_types" not in _fields_cache:
+        with open(FIELDS_DATA_DIR / "slicer_filament_types.json", encoding="utf-8") as f:
+            _fields_cache["slicer_filament_types"] = json.load(f)
+    entry = _fields_cache["slicer_filament_types"].get(preferred_slicer or "bambu_studio")
+    if not isinstance(entry, dict):
+        return data
+    options = [{"value": value, "label": value} for value in entry["values"]]
+    fields = [
+        {**field, "options": options} if field.get("key") == "filament_type" else field
+        for field in data.get("fields", [])
+    ]
+    return {**data, "fields": fields}
+
+
+async def _preset_fields(db: AsyncSession, preset_type: str) -> dict:
+    from backend.app.api.routes.settings import get_setting
+
+    data = _load_fields(preset_type)
+    if preset_type != "filament":
+        return data
+    return _with_slicer_material_types(data, await get_setting(db, "preferred_slicer"))
+
+
 @router.get("/builtin-filaments")
 async def get_builtin_filaments(
     _: User | None = RequirePermissionIfAuthEnabled(Permission.FILAMENTS_READ),
@@ -1424,11 +1458,15 @@ async def _build_filament_id_map(user: User | None, account: int | None) -> dict
 @router.get("/fields/{preset_type}")
 async def get_preset_fields(
     preset_type: Literal["filament", "print", "process", "printer"],
+    db: AsyncSession = Depends(get_db, scope="function"),
     _: User | None = RequirePermissionIfAuthEnabled(Permission.CLOUD_AUTH),
 ):
     """
     Get field definitions for a preset type.
 
+    For ``filament`` the Material type options are those of the preferred
+    slicer (Settings → Slicer): Bambu Studio's or OrcaSlicer's.
+
     Returns a list of field definitions including:
     - key: The setting key name
     - label: Human-readable label
@@ -1439,12 +1477,12 @@ async def get_preset_fields(
     - unit: Unit of measurement (if applicable)
     - min/max/step: For number fields, validation constraints
     """
-    data = _load_fields(preset_type)
-    return data
+    return await _preset_fields(db, preset_type)
 
 
 @router.get("/fields")
 async def get_all_preset_fields(
+    db: AsyncSession = Depends(get_db, scope="function"),
     _: User | None = RequirePermissionIfAuthEnabled(Permission.CLOUD_AUTH),
 ):
     """
@@ -1453,7 +1491,7 @@ async def get_all_preset_fields(
     Returns field definitions organized by type.
     """
     return {
-        "filament": _load_fields("filament"),
+        "filament": await _preset_fields(db, "filament"),
         "process": _load_fields("process"),
         "printer": _load_fields("printer"),
     }

+ 121 - 0
backend/app/data/slicer_filament_types.json

@@ -0,0 +1,121 @@
+{
+  "description": "Values of the `filament_type` option (the Type dropdown of a filament preset) in each slicer, keyed by the preferred_slicer setting. Read from the slicers' source: Bambu Studio's PrintConfig.cpp, OrcaSlicer's MaterialType.cpp (which PrintConfig.cpp loops over). A slicer release can differ.",
+  "bambu_studio": {
+    "source": "https://github.com/bambulab/BambuStudio/blob/master/src/libslic3r/PrintConfig.cpp (filament_type)",
+    "values": [
+      "PLA",
+      "ABS",
+      "ASA",
+      "ASA-CF",
+      "PETG",
+      "PCTG",
+      "TPU",
+      "TPU-AMS",
+      "PC",
+      "PA",
+      "PA-CF",
+      "PA-GF",
+      "PA6-CF",
+      "PLA-CF",
+      "PET-CF",
+      "PETG-CF",
+      "PVA",
+      "HIPS",
+      "PLA-AERO",
+      "PPS",
+      "PPS-CF",
+      "PPA-CF",
+      "PPA-GF",
+      "ABS-GF",
+      "ASA-AERO",
+      "PE",
+      "PP",
+      "EVA",
+      "PHA",
+      "BVOH",
+      "PE-CF",
+      "PP-CF",
+      "PP-GF"
+    ]
+  },
+  "orcaslicer": {
+    "source": "https://github.com/SoftFever/OrcaSlicer/blob/main/src/libslic3r/MaterialType.cpp (MaterialType::all)",
+    "values": [
+      "ABS",
+      "ABS-CF",
+      "ABS-GF",
+      "ASA",
+      "ASA-CF",
+      "ASA-GF",
+      "ASA-AERO",
+      "BVOH",
+      "CoPE",
+      "EVA",
+      "FLEX",
+      "HIPS",
+      "PA",
+      "PA-CF",
+      "PA-GF",
+      "PA6",
+      "PA6-CF",
+      "PA6-GF",
+      "PA11",
+      "PA11-CF",
+      "PA11-GF",
+      "PA12",
+      "PA12-CF",
+      "PA12-GF",
+      "PAHT",
+      "PAHT-CF",
+      "PAHT-GF",
+      "PC",
+      "PC-ABS",
+      "PC-CF",
+      "PC-PBT",
+      "PCL",
+      "PCTG",
+      "PE",
+      "PE-CF",
+      "PE-GF",
+      "PEI-1010",
+      "PEI-1010-CF",
+      "PEI-1010-GF",
+      "PEI-9085",
+      "PEI-9085-CF",
+      "PEI-9085-GF",
+      "PEEK",
+      "PEEK-CF",
+      "PEEK-GF",
+      "PEKK",
+      "PEKK-CF",
+      "PES",
+      "PET",
+      "PET-CF",
+      "PET-GF",
+      "PETG",
+      "PETG-CF",
+      "PETG-GF",
+      "PHA",
+      "PI",
+      "PLA",
+      "PLA-AERO",
+      "PLA-CF",
+      "POM",
+      "PP",
+      "PP-CF",
+      "PP-GF",
+      "PPA-CF",
+      "PPA-GF",
+      "PPS",
+      "PPS-CF",
+      "PPSU",
+      "PSU",
+      "PVA",
+      "PVB",
+      "PVDF",
+      "SBS",
+      "TPI",
+      "TPU"
+    ]
+  }
+}

+ 156 - 0
backend/tests/integration/test_cloud_fields_slicer_types_2928.py

@@ -0,0 +1,156 @@
+"""The profile editor's Material type follows the preferred slicer (#2928).
+
+Bambu Studio and OrcaSlicer do not accept the same ``filament_type`` values
+(Orca has SBS, Bambu Studio has TPU-AMS), so GET /cloud/fields/filament offers
+those of the slicer chosen in Settings -> Slicer, and nothing else about the
+field definitions changes.
+"""
+
+import json
+from pathlib import Path
+
+import pytest
+from httpx import AsyncClient
+from sqlalchemy import update
+
+from backend.app.api.routes.cloud import _load_fields
+from backend.app.models.settings import Settings
+
+DATA = Path(__file__).resolve().parents[2] / "app" / "data"
+
+
+def _type_field(fields: dict) -> dict:
+    return next(f for f in fields["fields"] if f["key"] == "filament_type")
+
+
+def _values(fields: dict) -> list[str]:
+    return [option["value"] for option in _type_field(fields)["options"]]
+
+
+async def _prefer(db_session, slicer: str) -> None:
+    """Set the preferred slicer, whether or not the setting exists yet."""
+    changed = await db_session.execute(update(Settings).where(Settings.key == "preferred_slicer").values(value=slicer))
+    if not changed.rowcount:
+        db_session.add(Settings(key="preferred_slicer", value=slicer))
+    await db_session.commit()
+
+
+class TestFilamentFieldsFollowThePreferredSlicer:
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_bambu_studio_is_the_default(self, async_client: AsyncClient):
+        response = await async_client.get("/api/v1/cloud/fields/filament")
+
+        assert response.status_code == 200
+        values = _values(response.json())
+        assert "TPU-AMS" in values
+        assert "SBS" not in values
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_bambu_studio_offers_its_own_types(self, async_client: AsyncClient, db_session):
+        await _prefer(db_session, "bambu_studio")
+
+        values = _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+        assert (
+            values
+            == json.loads((DATA / "slicer_filament_types.json").read_text(encoding="utf-8"))["bambu_studio"]["values"]
+        )
+        assert {"TPU-AMS", "ASA-AERO", "PE-CF"} <= set(values)
+        assert {"SBS", "PA6-GF", "PEEK"}.isdisjoint(values)
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_orcaslicer_offers_its_own_types(self, async_client: AsyncClient, db_session):
+        await _prefer(db_session, "orcaslicer")
+
+        values = _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+        assert (
+            values
+            == json.loads((DATA / "slicer_filament_types.json").read_text(encoding="utf-8"))["orcaslicer"]["values"]
+        )
+        assert {"SBS", "PA6-GF", "PEEK"} <= set(values)
+        assert "TPU-AMS" not in values
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_changing_the_slicer_changes_the_list_on_the_next_request(
+        self, async_client: AsyncClient, db_session
+    ):
+        await _prefer(db_session, "orcaslicer")
+        assert "SBS" in _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+        await _prefer(db_session, "bambu_studio")
+
+        assert "SBS" not in _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_an_unknown_slicer_leaves_the_list_as_the_field_file_has_it(
+        self, async_client: AsyncClient, db_session
+    ):
+        await _prefer(db_session, "someslicer")
+
+        values = _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+        assert values == _values(_load_fields("filament"))
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_only_the_material_type_dropdown_changes(self, async_client: AsyncClient, db_session):
+        await _prefer(db_session, "orcaslicer")
+
+        served = (await async_client.get("/api/v1/cloud/fields/filament")).json()
+
+        static = _load_fields("filament")
+        assert [f["key"] for f in served["fields"]] == [f["key"] for f in static["fields"]]
+        others = [
+            (f, s) for f, s in zip(served["fields"], static["fields"], strict=True) if f["key"] != "filament_type"
+        ]
+        assert all(f == s for f, s in others)
+        served_type = _type_field(served)
+        static_type = _type_field(static)
+        assert {k: v for k, v in served_type.items() if k != "options"} == {
+            k: v for k, v in static_type.items() if k != "options"
+        }
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_the_other_preset_types_are_not_touched(self, async_client: AsyncClient, db_session):
+        await _prefer(db_session, "orcaslicer")
+
+        for preset_type in ("process", "printer"):
+            served = (await async_client.get(f"/api/v1/cloud/fields/{preset_type}")).json()
+            assert served == _load_fields(preset_type)
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_the_all_fields_route_follows_the_slicer_too(self, async_client: AsyncClient, db_session):
+        await _prefer(db_session, "orcaslicer")
+
+        served = (await async_client.get("/api/v1/cloud/fields")).json()
+
+        assert "SBS" in _values(served["filament"])
+
+    @pytest.mark.asyncio
+    @pytest.mark.integration
+    async def test_serving_one_slicer_does_not_change_the_next(self, async_client: AsyncClient, db_session):
+        """The field file is cached; the list swap must work on a copy."""
+        await _prefer(db_session, "orcaslicer")
+        await async_client.get("/api/v1/cloud/fields/filament")
+
+        await _prefer(db_session, "someslicer")
+        values = _values((await async_client.get("/api/v1/cloud/fields/filament")).json())
+
+        assert "SBS" not in values
+
+
+def test_the_lists_are_well_formed():
+    data = json.loads((DATA / "slicer_filament_types.json").read_text(encoding="utf-8"))
+    for slicer in ("bambu_studio", "orcaslicer"):
+        values = data[slicer]["values"]
+        assert len(values) == len(set(values)), f"{slicer} lists a type twice"
+        assert "PLA" in values and "PETG" in values and "ABS" in values and "TPU" in values
+        assert data[slicer]["source"].startswith("https://")

+ 189 - 0
frontend/src/__tests__/pages/ProfilesPageMaterialTypes.test.tsx

@@ -0,0 +1,189 @@
+/**
+ * The preset editor's Material type dropdown follows the preferred slicer (#2928).
+ *
+ * The backend serves the options of the slicer chosen in Settings -> Slicer;
+ * the editor must fetch them again when that choice changes, and a profile's
+ * own type must stay visible even when the list does not have it.
+ */
+
+import { describe, it, expect, beforeEach, afterEach } from 'vitest';
+import { act, screen, waitFor } from '@testing-library/react';
+import userEvent from '@testing-library/user-event';
+import { useEffect } from 'react';
+import { useQueryClient, type QueryClient } from '@tanstack/react-query';
+import { http, HttpResponse } from 'msw';
+import { render } from '../utils';
+import { server } from '../mocks/server';
+import { ProfilesPage } from '../../pages/ProfilesPage';
+import { setAuthToken } from '../../api/client';
+
+const USER_PRESET = {
+  setting_id: 'PFUS-types-1',
+  name: 'My Custom Type @BBL X1C',
+  type: 'filament',
+  version: null,
+  user_id: 'u1',
+  updated_time: null,
+  is_custom: true,
+};
+const BUILTIN_PRESET = {
+  setting_id: 'GFSA00',
+  name: 'Bambu PLA Basic @BBL X1C',
+  type: 'filament',
+  version: null,
+  user_id: null,
+  updated_time: null,
+  is_custom: false,
+};
+
+const OPTIONS = {
+  bambu_studio: ['PLA', 'TPU-AMS'],
+  orcaslicer: ['PLA', 'SBS'],
+} as const;
+
+let slicer: keyof typeof OPTIONS;
+let presetType: string | undefined;
+
+function fieldsFor(chosen: keyof typeof OPTIONS) {
+  return {
+    version: '1',
+    description: '',
+    fields: [
+      {
+        key: 'filament_type',
+        label: 'Filament Type',
+        type: 'select',
+        category: 'basic',
+        description: 'Material type',
+        options: OPTIONS[chosen].map((value) => ({ value, label: value })),
+      },
+    ],
+  };
+}
+
+beforeEach(() => {
+  slicer = 'bambu_studio';
+  presetType = 'SBS';
+  server.use(
+    http.get('*/api/v1/cloud/status', () =>
+      HttpResponse.json({ is_authenticated: true, email: 'user@example.com', region: 'global' }),
+    ),
+    http.get('*/api/v1/printers/', () => HttpResponse.json([])),
+    http.get('*/api/v1/settings/', () => HttpResponse.json({ preferred_slicer: slicer })),
+    http.get('*/api/v1/cloud/settings', () =>
+      HttpResponse.json({ filament: [USER_PRESET, BUILTIN_PRESET], printer: [], process: [] }),
+    ),
+    http.get('*/api/v1/cloud/settings/:id', ({ params }) =>
+      HttpResponse.json({
+        setting_id: params.id,
+        name: params.id === USER_PRESET.setting_id ? USER_PRESET.name : BUILTIN_PRESET.name,
+        base_id: 'GFSA00',
+        setting:
+          params.id === USER_PRESET.setting_id
+            ? { inherits: BUILTIN_PRESET.name, filament_type: presetType }
+            : { filament_type: 'PLA' },
+      }),
+    ),
+    http.get('*/api/v1/cloud/fields/:type', () => {
+      return HttpResponse.json(fieldsFor(slicer));
+    }),
+  );
+});
+
+afterEach(() => {
+  setAuthToken(null);
+});
+
+// The test's QueryClient, to change the settings the way the Settings page does.
+let queryClient: QueryClient | undefined;
+function GrabQueryClient() {
+  const client = useQueryClient();
+  useEffect(() => {
+    queryClient = client;
+  }, [client]);
+  return null;
+}
+
+async function openCreateModal(user: ReturnType<typeof userEvent.setup>) {
+  await user.click(await screen.findByRole('button', { name: 'New Preset' }));
+  await screen.findByText('Create New Preset');
+  const baseSelect = screen.getByText('Base Preset').parentElement!.querySelector('select')!;
+  await user.selectOptions(baseSelect, 'GFSA00');
+}
+
+function typeSelect(): HTMLSelectElement {
+  return screen.getByText('Filament Type').closest('div')!.parentElement!.querySelector('select')!;
+}
+
+const optionValues = (select: HTMLSelectElement) =>
+  [...select.querySelectorAll('option')].map((o) => o.getAttribute('value')).filter((v) => v);
+
+describe('ProfilesPage: Material type options', () => {
+  it('offers what the server sends for the preferred slicer', async () => {
+    const user = userEvent.setup();
+    slicer = 'orcaslicer';
+    render(<ProfilesPage />);
+
+    await openCreateModal(user);
+
+    await waitFor(() => expect(optionValues(typeSelect())).toEqual(['PLA', 'SBS']));
+  });
+
+  it('shows Bambu Studio’s list when that is the preferred slicer', async () => {
+    const user = userEvent.setup();
+    render(<ProfilesPage />);
+
+    await openCreateModal(user);
+
+    await waitFor(() => expect(optionValues(typeSelect())).toEqual(['PLA', 'TPU-AMS']));
+  });
+
+  it('fetches the list again when the preferred slicer changes', async () => {
+    const user = userEvent.setup();
+    render(
+      <>
+        <ProfilesPage />
+        <GrabQueryClient />
+      </>,
+    );
+
+    await openCreateModal(user);
+    await waitFor(() => expect(optionValues(typeSelect())).toEqual(['PLA', 'TPU-AMS']));
+
+    // Settings -> Slicer saved: the page writes the new settings into the cache.
+    slicer = 'orcaslicer';
+    act(() => {
+      queryClient!.setQueryData(['settings'], { preferred_slicer: 'orcaslicer' });
+    });
+
+    await waitFor(() => expect(optionValues(typeSelect())).toEqual(['PLA', 'SBS']));
+  });
+
+  it('keeps a profile’s own type selectable when the list does not have it', async () => {
+    const user = userEvent.setup();
+    presetType = 'HSPLA+2.0';
+    render(<ProfilesPage />);
+
+    await user.click(await screen.findByText(USER_PRESET.name));
+    const edit = await screen.findByRole('button', { name: 'Edit' });
+    await waitFor(() => expect(edit).not.toBeDisabled());
+    await user.click(edit);
+
+    await waitFor(() => expect(typeSelect().value).toBe('HSPLA+2.0'));
+    expect(optionValues(typeSelect())).toEqual(['HSPLA+2.0', 'PLA', 'TPU-AMS']);
+  });
+
+  it('does not add an option for a type the list has', async () => {
+    const user = userEvent.setup();
+    presetType = 'TPU-AMS';
+    render(<ProfilesPage />);
+
+    await user.click(await screen.findByText(USER_PRESET.name));
+    const edit = await screen.findByRole('button', { name: 'Edit' });
+    await waitFor(() => expect(edit).not.toBeDisabled());
+    await user.click(edit);
+
+    await waitFor(() => expect(typeSelect().value).toBe('TPU-AMS'));
+    expect(optionValues(typeSelect())).toEqual(['PLA', 'TPU-AMS']);
+  });
+});

+ 11 - 1
frontend/src/pages/ProfilesPage.tsx

@@ -1369,9 +1369,14 @@ function CreatePresetModal({
     return presetsOfType.filter(p => isUserPreset(p.setting_id));
   }, [presetsOfType]);
 
+  // The Material type options are those of the preferred slicer (#2928), so
+  // changing it in Settings has to fetch the definitions again.
+  const { data: appSettings } = useQuery({ queryKey: ['settings'], queryFn: api.getSettings });
+  const preferredSlicer = appSettings?.preferred_slicer;
+
   // Fetch field definitions from API (cached, only loaded once per type)
   const { data: fieldDefinitions } = useQuery({
-    queryKey: ['cloudFields', presetType],
+    queryKey: ['cloudFields', presetType, preferredSlicer],
     queryFn: () => api.getCloudFields(presetType === 'print' ? 'process' : presetType),
     staleTime: 1000 * 60 * 60, // Cache for 1 hour
   });
@@ -1712,6 +1717,11 @@ function CreatePresetModal({
           className={baseClass}
         >
           <option value="">{placeholder}</option>
+          {/* A value the list does not have, like a type the other slicer
+              offers, stays selectable instead of showing as empty (#2928). */}
+          {typeof value === 'string' && value !== '' && !field.options?.some(opt => opt.value === value) && (
+            <option value={value}>{value}</option>
+          )}
           {field.options?.map(opt => (
             <option key={opt.value} value={opt.value}>{opt.label}</option>
           ))}