{"record":{"id":"ceb539bc749dfe53","repo":"eythaann/Seelen-UI","slug":"monitor-settings-not-initialized-device-id","errorCode":null,"errorMessage":"Monitor settings not initialized ${device.id}","messagePattern":"Monitor settings not initialized (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"src/ui/react/settings/modules/ByMonitor/infra/index.tsx","lineNumber":91,"sourceCode":"              );\n            })}\n          </SettingsGroup>\n        </div>\n      </div>\n    </SettingsGroup>\n  );\n}\n\nexport function SettingsByMonitor() {\n  const devices = monitors.value;\n  const settingsByMonitor = settings.value.monitorsV3;\n\n  return (\n    <>\n      {devices.map((device) => {\n        let monitor = settingsByMonitor[device.id];\n        if (!monitor) {\n          console.warn(`Monitor settings not initialized ${device.id}`);\n          return null;\n        }\n        return <MonitorConfig key={device.id} device={device} />;\n      })}\n    </>\n  );\n}\n\nfunction isConfigurableByMonitor(widget: Widget) {\n  if (widget.instances === \"ReplicaByMonitor\") {\n    return true;\n  }\n\n  // Check if any setting item allows configuration by monitor\n  const stack = [...widget.settings];\n\n  while (stack.length > 0) {\n    const definition = stack.pop()!;","sourceCodeStart":73,"sourceCodeEnd":109,"githubUrl":"https://github.com/eythaann/Seelen-UI/blob/dee4aaa94066c5d0888ab25554864862fc47be15/src/ui/react/settings/modules/ByMonitor/infra/index.tsx#L73-L109","documentation":"The settings app's ByMonitor module renders a MonitorConfig for each display device using a settings record keyed by device id. When settingsByMonitor[device.id] is undefined — the per-monitor settings entry has not been initialized/loaded for that device — the component logs this warning and renders null for that monitor instead of crashing.","triggerScenarios":"A monitor present in the OS device list has no corresponding entry in the per-monitor settings map: settings not yet loaded when the component renders, a monitor added/plugged in after settings were loaded, or a stale settings file that predates the device id.","commonSituations":"Opening settings immediately at startup before async settings fetch resolves; hot-plugging a monitor while settings is open; changing GPU drivers or display topology producing new device ids; migrating settings across machines where monitor ids differ.","solutions":["Wait for the settings/device data to finish loading before rendering the list (show a loader until the settings-by-monitor signal is populated).","Re-open the settings window after the monitor is connected so devices and settings are re-fetched together.","Ensure every detected device gets a default entry: when loading settings, merge in defaults for any device id missing from settingsByMonitor.","If a device id is permanently stale (driver/topology change), reset or repair the monitor settings store."],"exampleFix":"// before\nlet monitor = settingsByMonitor[device.id];\nif (!monitor) {\n  console.warn(`Monitor settings not initialized ${device.id}`);\n  return null;\n}\n\n// after\nlet monitor = settingsByMonitor[device.id];\nif (!monitor) {\n  console.warn(`Monitor settings not initialized ${device.id}`);\n  monitor = createDefaultMonitorSettings(device); // render with defaults instead of null\n}","handlingStrategy":"fallback","validationCode":"const ready = devices.every(d => settingsByMonitor[d.id] != null);\nif (!ready) return <Spinner />; // render loader until per-monitor settings are loaded","typeGuard":"function hasMonitorSettings(d: Device, s: Record<string, MonitorSettings>):\n  d is Device & { id: string } {\n  return s[d.id] != null;\n}","tryCatchPattern":null,"preventionTips":["Gate rendering on settings being fully loaded (async signal resolved) instead of rendering per-device immediately.","Seed default settings for every detected device id when loading, so lookups never miss.","Re-fetch devices/settings on display-change events to handle hot-plugged monitors.","Expect device ids to change across driver updates or hardware changes; don't persist them as stable keys without fallbacks."],"tags":["react","settings","monitor","initialization","race-condition"],"backgroundTag":"settings-not-initialized","analyzedSha":"dee4aaa94066c5d0888ab25554864862fc47be15","analyzedAt":"2026-09-03T10:20:37.842Z","contentChangedAt":"2026-09-03T10:20:37.842Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}