{"record":{"id":"22ec1af86a9f0bdd","repo":"Foundry376/Mailspring","slug":"menu-parent-did-not-return-an-itemkey-for-item","errorCode":null,"errorMessage":"Menu parent did not return an itemKey for item","messagePattern":"Menu parent did not return an itemKey for item","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"app/src/components/menu.tsx","lineNumber":405,"sourceCode":"\n    const items = (this.props.items || []).map((item, i) => {\n      const content = this.props.itemContent(item);\n      if (React.isValidElement(content) && content.type === MenuItem) {\n        return content;\n      }\n\n      const onMouseDown = (event: React.MouseEvent<HTMLDivElement>) => {\n        event.preventDefault();\n        const key = this.props.itemKey(item);\n        this.setState({ selectedIndex: i, selectedItemKey: key });\n        if (this.props.onSelect) {\n          return this.props.onSelect(item);\n        }\n      };\n\n      const key = this.props.itemKey(item);\n      if (!key) {\n        console.warn('Menu parent did not return an itemKey for item', item);\n      }\n      if (seenItemKeys[key]) {\n        console.warn({ 'Menu items have colliding keys': item }, seenItemKeys[key]);\n      }\n      seenItemKeys[key] = item;\n\n      return (\n        <MenuItem\n          key={key}\n          id={this.props.listboxId ? `${this.props.listboxId}-option-${key}` : undefined}\n          role={this.props.listboxId ? 'option' : undefined}\n          onMouseDown={onMouseDown}\n          checked={this.props.itemChecked && this.props.itemChecked(item)}\n          content={content}\n          selected={this.state.selectedIndex === i}\n          suppressAriaSelected={!!this.props.onActiveDescendantChange}\n        />\n      );","sourceCodeStart":387,"sourceCodeEnd":423,"githubUrl":"https://github.com/Foundry376/Mailspring/blob/648c685d602ece6bb00c22534b8734de6ac644b3/app/src/components/menu.tsx#L387-L423","documentation":"Warning while rendering Menu items: the parent's itemKey prop returned a falsy key (undefined/'') for an item, so React has no stable identity for the row and selection state (selectedItemKey) cannot round-trip. The menu still renders, but keyboard selection and highlighting misbehave.","triggerScenarios":"Thrown at app/src/components/menu.tsx:405 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Fix the itemKey callback to return a unique non-empty string/id for every item","Filter out empty placeholder items before passing them to Menu"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"648c685d602ece6bb00c22534b8734de6ac644b3","analyzedAt":"2026-09-03T02:00:24.311Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-10T07:17:11.731Z"}