Bug: Clearing the Reasoning Description in Online Service Filters does not persist after save

Objective

  • Restore expected behavior when users clear the Reasoning Description (and optionally the Question for Children) on an Online Service Filter option: the saved value should persist as blank after save and refresh.
  • Users expect that clearing an optional field and saving will result in that field remaining empty; currently the previous text reappears.

Background

  • In Settings → Scheduling → Online Service Filter, the Edit/Add Filter Option modal includes a "Reasoning Description" textarea. When a user clears this field, saves, and refreshes, the old text is still present; the clear does not persist.
  • The save request succeeds and shows a success toast; the failure is that the backend never receives a value that means "clear this field," so the stored value is left unchanged.
  • The same pattern may affect the optional "Question for Children" field if users clear it—same payload shape applies.

Scope

Frontend

  • attik-frontend/src/app/tools/settings/scheduling/online-service-filter/ServiceFilterOptionModal.tsx — The modal holds description and question in local state and, on save, sends them as description.trim() || undefined and question.trim() || undefined. When the user clears a field, that becomes undefined and is omitted from the JSON body. The fix must ensure that when the user intends to clear a field, the backend receives an explicit value that means "clear" (e.g. empty string) so the stored value can be updated. The same consideration applies for both create and update payloads.

Backend

  • attik-backend/src/routes/serviceFilter.ts — The PUT /options/:id handler updates option.description and option.question only when the corresponding key is present in the request body (if (description !== undefined) option.description = description;). When the frontend omits the key (because it sent undefined), the backend does not change the field. No backend change is strictly required if the frontend starts sending an explicit empty string for "cleared" optional fields; the existing logic will then set the stored value to empty. If the team prefers the backend to treat a missing key as "clear," that would be a separate decision and would need to be applied consistently for optional string fields on this endpoint.
  • attik-backend/src/models/serviceFilterOptionSchema.ts — The description and question fields are optional (required: false). Storing an empty string is valid and already supported.

Decision

  • Whether to fix only on the frontend (send empty string when user clears) or also change backend semantics for missing keys is a dev decision; the minimal fix is frontend-only.

References

  • Modal and save payload: attik-frontend/src/app/tools/settings/scheduling/online-service-filter/ServiceFilterOptionModal.tsx (handleSave, update and create payloads)
  • Update endpoint: attik-backend/src/routes/serviceFilter.ts (PUT /options/:id)
  • Option model: attik-backend/src/models/serviceFilterOptionSchema.ts

Please authenticate to join the conversation.

Upvoters
Status

Planned

Board
💡

New Features

Date

18 days ago

Author

Linear

Subscribe to post

Get notified by email when there are changes.