Skip to content

Conversation

sczheng189
Copy link

Problem

When custom fields like CUSTOM_ROUTER_PATH are manually added to config.json, they get lost when the configuration is saved through the UI interface.

Root Cause

The UI's ConfigProvider component uses a hardcoded list of fields and filters out any unknown fields when reading and saving the configuration.

Solution

  1. Added missing fields (CUSTOM_ROUTER_PATH and NON_INTERACTIVE_MODE) to the Config interface
  2. Added an index signature to allow arbitrary custom fields
  3. Modified ConfigProvider to preserve all original config fields
  4. Only validate and set defaults for known fields while keeping unknown fields intact

Changes

  • Modified ui/src/types.ts: Added missing fields and index signature
  • Modified ui/src/components/ConfigProvider.tsx: Preserve all config fields using spread operator
  • Fixed type casting issues in ui/src/App.tsx

Testing

  • Built the UI successfully with npm run build
  • No TypeScript errors
  • Custom fields are now preserved when saving through UI

This ensures backward compatibility and allows users to add custom configuration fields without losing them when using the UI.

- Add CUSTOM_ROUTER_PATH and NON_INTERACTIVE_MODE to Config interface
- Add index signature to Config interface to allow custom fields
- Modify ConfigProvider to preserve all original config fields
- Only validate and set defaults for known fields
- Fix type casting issues in App.tsx

This ensures that custom fields like CUSTOM_ROUTER_PATH won't be lost when the config is saved through the UI interface.
@sczheng189 sczheng189 force-pushed the fix/ui-config-custom-fields branch from 0c42c34 to a09e10c Compare August 25, 2025 11:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant