Skip to content

impr: enable spaces in preset names to unify naming logic (@byseif21)#7702

Open
byseif21 wants to merge 10 commits intomonkeytypegame:masterfrom
byseif21:impr/allow-space-in-preset
Open

impr: enable spaces in preset names to unify naming logic (@byseif21)#7702
byseif21 wants to merge 10 commits intomonkeytypegame:masterfrom
byseif21:impr/allow-space-in-preset

Conversation

@byseif21
Copy link
Contributor

@byseif21 byseif21 commented Mar 22, 2026

  • allow spaces in preset like in tag names (displayed with spaces, stored with underscores)

@monkeytypegeorge monkeytypegeorge added frontend User interface or web stuff packages Changes in local packages labels Mar 22, 2026
@byseif21 byseif21 marked this pull request as ready for review March 23, 2026 12:59
Copilot AI review requested due to automatic review settings March 23, 2026 12:59
@github-actions github-actions bot added the waiting for review Pull requests that require a review before continuing label Mar 23, 2026
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Enables spaces in preset/tag/result-filter preset names by normalizing user input (trim + whitespace → underscores) at the schema level and updating frontend modals to rely on schema parsing while continuing to display names with spaces.

Changes:

  • Add whitespace-normalizing transforms to ResultFiltersSchema.name, TagNameSchema, and PresetNameSchema.
  • Update tag/preset creation & edit flows to parse/validate via the shared schemas and derive display from underscore-stored names.
  • Remove ad-hoc space→underscore replacement in createFilterPreset.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
packages/schemas/src/users.ts Normalize ResultFiltersSchema.name + TagNameSchema to allow spaces (stored as _).
packages/schemas/src/presets.ts Normalize PresetNameSchema to allow spaces (stored as _).
frontend/src/ts/modals/new-filter-preset.ts Parse/clean filter preset names via schema before API call.
frontend/src/ts/modals/edit-tag.ts Remove manual cleaning; parse via schema; set display from normalized name.
frontend/src/ts/modals/edit-preset.ts Validate preset names via schema and display space-form names; store underscore-form.
Comments suppressed due to low confidence (2)

frontend/src/ts/modals/edit-preset.ts:270

  • Avoid PresetNameSchema.safeParse(...).data ?? "" here; it redundantly re-parses and the fallback can silently send an empty name if this code is refactored later. Prefer using the already-validated parsed value from the earlier safeParse (or parse) call.
  if (action === "add") {
    const configChanges = getConfigChanges();
    const activeSettingGroups = getActiveSettingGroupsFromState();
    const presetName = PresetNameSchema.safeParse(propPresetName).data ?? "";
    const response = await Ape.presets.add({
      body: {
        name: presetName,
        config: configChanges,

frontend/src/ts/modals/edit-preset.ts:307

  • Same as the add branch: this re-parses propPresetName and falls back to "". Reuse the earlier validated/normalized preset name to avoid duplicate schema work and avoid any possibility of an empty name being sent.
    const configChanges = getConfigChanges();
    const activeSettingGroups: ConfigGroupName[] | null =
      state.presetType === "partial" ? getActiveSettingGroupsFromState() : null;
    const presetName = PresetNameSchema.safeParse(propPresetName).data ?? "";
    const response = await Ape.presets.save({
      body: {
        _id: presetId,
        name: presetName,
        ...(updateConfig && {

@github-actions github-actions bot removed the waiting for review Pull requests that require a review before continuing label Mar 23, 2026
@Miodec Miodec added the waiting for update Pull requests or issues that require changes/comments before continuing label Mar 23, 2026
@github-actions github-actions bot removed the waiting for update Pull requests or issues that require changes/comments before continuing label Mar 23, 2026
keep name normalization in frontend, restore strict schema validation
@monkeytypegeorge monkeytypegeorge removed the packages Changes in local packages label Mar 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend User interface or web stuff

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants