Context
The Configuration Builder (#162) needs state management to track user selections
across SDK options and instrumentation configurations. This hook will be the central
state management solution for the entire Configuration Builder UI.
Related to #178 (YAML Output) - this hook's state will be consumed to generate output.
This follows the established hooks pattern in the project:
- See
src/hooks/use-javaagent-data.ts for the data loading pattern
- See
context/data-layer-implementation.md for the three-tier caching strategy
- The Configuration Builder should follow similar patterns but for form state
Implementation Guidance
File Location
Create: ecosystem-explorer/src/hooks/use-configuration-builder.ts
Tests: ecosystem-explorer/src/hooks/use-configuration-builder.test.ts
Reference Patterns
Existing React hooks in the project:
src/hooks/use-javaagent-data.ts - shows proper hook structure, error handling
- Similar pattern needed but for form state instead of data fetching
Data types:
- Configuration schema types will come from
src/types/configuration.ts (to be created)
- Should align with schema in
ecosystem-registry/configuration/
Architecture Integration
This hook should:
- Manage local form state
- Optionally persist to localStorage for user convenience
- Provide type-safe accessors for all config values
- Handle validation state per field
- Support undo/redo (nice to have)
Requirements
Actions to Provide
const {
state,
setValue, // (path: string, value: unknown) => void
setEnabled, // (section: string, enabled: boolean) => void
resetToDefaults, // () => void
loadFromYaml, // (yaml: string) => void
validateAll, // () => ValidationResult
clearValidationError, // (path: string) => void
} = useConfigurationBuilder();
Persistence Strategy
- Use localStorage to persist state across sessions
- Key:
otel-config-builder-state-v1
- Auto-save on every change (debounced to 500ms)
- Load from localStorage on hook initialization
- Provide manual "Export State" / "Import State" for sharing (can be done in a followup if necessary)
Acceptance Criteria
Related Issues
Context
The Configuration Builder (#162) needs state management to track user selections
across SDK options and instrumentation configurations. This hook will be the central
state management solution for the entire Configuration Builder UI.
Related to #178 (YAML Output) - this hook's state will be consumed to generate output.
This follows the established hooks pattern in the project:
src/hooks/use-javaagent-data.tsfor the data loading patterncontext/data-layer-implementation.mdfor the three-tier caching strategyImplementation Guidance
File Location
Create:
ecosystem-explorer/src/hooks/use-configuration-builder.tsTests:
ecosystem-explorer/src/hooks/use-configuration-builder.test.tsReference Patterns
Existing React hooks in the project:
src/hooks/use-javaagent-data.ts- shows proper hook structure, error handlingData types:
src/types/configuration.ts(to be created)ecosystem-registry/configuration/Architecture Integration
This hook should:
Requirements
Actions to Provide
Persistence Strategy
otel-config-builder-state-v1Acceptance Criteria
Related Issues