Skip to content

fix(extension): finish Included Memories leftovers on T3 (#1257) - #1421

Open
HaoChiBao wants to merge 3 commits into
supermemoryai:mainfrom
HaoChiBao:fix/extension-t3-included-memories-lifecycle
Open

fix(extension): finish Included Memories leftovers on T3 (#1257)#1421
HaoChiBao wants to merge 3 commits into
supermemoryai:mainfrom
HaoChiBao:fix/extension-t3-included-memories-lifecycle

Conversation

@HaoChiBao

Copy link
Copy Markdown

Summary

Why this PR includes #1339

Bugs 2–4 depend on correct list indexing. Landing only the lifecycle fix on main without the JSON serialize would keep delete indexes wrong for comma-containing memories. Happy to adjust if maintainers prefer to merge #1339 first and drop that commit from this PR.

Test plan

  • bun test entrypoints/content/memory-suggestion.test.ts (9 pass)
  • On t3.chat: trigger Included Memories with 2+ memories; remove one → the other remains injected
  • Trigger auto-search repeatedly → only one popup / click listener remains (no stacked body nodes)
  • Remove all memories → marker resets; leave one → prompt renumbers 1. …

Fixes #1257

Related: #1339

abhay-codes07 and others added 2 commits August 6, 2026 00:45
…ines

The Included Memories popup stores the memory list on a data-* attribute by
joining it into a single string (String(response.data) / response.data), then
reads it back by splitting on [,\n] in showMarkerPopover and in the T3 popup.
Memory text is free-form and frequently contains commas and newlines, so a
single memory was fragmented into several rows. In T3 that also desynced the
per-item delete: the clicked index no longer mapped to a real memory, so
removal spliced the wrong entry and rewrote the injected prompt from the
mangled list.

Store the list as JSON on the attribute and parse it back, so a memory with a
comma or newline survives as one item. serializeMemoriesForDataset returns an
empty string for an empty list so existing "memories present" truthiness checks
on the attribute are unchanged, and parseMemoriesFromDataset falls back to the
old delimiter split for any legacy value. This is confined to the popup's own
display data: the GET_RELATED_MEMORIES response and the injected
dataset.supermemories prompt text are left exactly as they were, so recall
behaviour does not change. Applied consistently across ChatGPT, Claude, Gemini
and T3, with unit tests for the round-trip.
After a removal, only clear when zero memories remain, dispose prior
popup click listeners before remounting, and rebuild the injected prompt
with renumbered entries instead of a comma-joined string.
Drop the one-line shouldClear helper, collapse popup dispose state into
one object, and exit early on empty removal instead of reindexing dead UI.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

extension related to Supermemory Chrome Extension

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Extension: Included Memories popup fragments comma-containing memories, leaks global click listeners, and drops the last memory on removal

2 participants