PostHog / PostHog/posthog

[notebooks] Creating a note throws a "-undefined" kea store error (accounts New note)

Open Beginner friendly
#68,902 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

feature/customer-analytics
Dominant language
Python
Stars
39.9k
Forks
3.4k
Avg merge
6h 51m
Merged PRs (30d)
232

Description

Summary

Creating a note from an account ("New note" in the Notes tab) throws [KEA] Can not find path "scenes.notebooks.Notebook.notebookLogic.<shortId>-undefined" in the store. notebookLogic is keyed as ${shortId}-${mode}, but the notebook side panel mounts it without passing mode, so the key resolves to <shortId>-undefined and fails to match the mounted instance. The fix is a one-line default in the key function.

Part of #68887.

Note: the fix is in the notebooks product; it surfaces from the accounts "New note" flow (accountNotebooksLogic.createNote → opens the notebook in the side panel).

Details for coding agents

Root cause

  • notebookLogic key: key(({ shortId, mode }) => ${shortId}-${mode}). mode is optional (mode?: NotebookLogicMode) and only defaults to 'notebook' inside a selector, not in the key function.
  • notebookPanelLogic and NotebookPanel mount the logic / render <Notebook shortId=... /> without a mode prop, so mode is undefined and the key becomes <shortId>-undefined, which doesn't match any mounted path.

Proposed fix
Default mode in the key function so it always produces a valid, matching key:

key(({ shortId, mode }) => `${shortId}-${mode ?? 'notebook'}`)

This mirrors the existing selector default. Optionally also pass an explicit mode from NotebookPanel.

References

  • frontend/src/scenes/notebooks/Notebook/notebookLogic.ts:301 — key function ${shortId}-${mode}
  • frontend/src/scenes/notebooks/Notebook/notebookLogic.ts:246mode?: NotebookLogicMode (optional)
  • frontend/src/scenes/notebooks/Notebook/notebookLogic.ts:1010 — selector default props.mode ?? 'notebook'
  • frontend/src/scenes/notebooks/NotebookPanel/NotebookPanel.tsx:34,95 — mounts logic / renders <Notebook> without mode
  • products/customer_analytics/frontend/components/Accounts/accountNotebooksLogic.tscreateNote flow that triggers it

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in frontend/src/scenes/notebooks/Notebook/notebookLogic.ts at the key function, then inspect NotebookPanel/NotebookPanel.tsx and the accountNotebooksLogic.ts createNote flow. Reproduce the account “New note” action and verify the notebook side panel no longer requests a -undefined store path.

Written by the indexing model from the issue text.

Assessment

Tech stack
react, typescript
Domain
frontend
Issue type
Bug
Difficulty
1/5
Estimated time
Under an hour
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
82/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.