Clicking a second photoresistor (or any second sensor of the same metadataId) showed the previously-clicked sensor's slider value because the panel was reused across clicks and its useState only ran once. The mount useEffect also unconditionally dispatched config defaults, which would have wiped any prior customisation if we naively remounted. Three changes: - SensorUpdateRegistry caches the last-dispatched values per componentId (and clears them on unregister) so the panel has a place to read from. - SensorControlPanel hydrates from that cache on mount, falling back to config defaults only when the sensor has never been touched. The default-dispatch useEffect skips when cached values already exist. - SimulatorCanvas keys the panel on sensorControlComponentId, forcing a fresh mount when the user switches sensors — without that, hydration wouldn't run on subsequent opens. |
||
|---|---|---|
| .. | ||
| __pro_stub__ | ||
| __tests__ | ||
| assets | ||
| components | ||
| data | ||
| hooks | ||
| i18n | ||
| lib | ||
| pages | ||
| services | ||
| simulation | ||
| store | ||
| tokens | ||
| types | ||
| utils | ||
| velxio-elements | ||
| App.css | ||
| App.tsx | ||
| entry-server.tsx | ||
| index.css | ||
| main.tsx | ||
| seoRoutes.ts | ||
| vite-env.d.ts | ||