fix(extension): finish Included Memories leftovers on T3 (#1257) - #1421
Open
HaoChiBao wants to merge 3 commits into
Open
fix(extension): finish Included Memories leftovers on T3 (#1257)#1421HaoChiBao wants to merge 3 commits into
HaoChiBao wants to merge 3 commits into
Conversation
…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.
4 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
dataset.memoriesDataround-trip (cherry-picked from fix(extension): stop fragmenting Included Memories that contain commas or newlines #1339) so comma-bearing memories and delete indexes stay correct.<= 1→ only clear when empty), disposes prior popup +documentclick listeners before remounting, and rebuilds the injected prompt with renumbered memories viabuildSupermemoryText.Why this PR includes #1339
Bugs 2–4 depend on correct list indexing. Landing only the lifecycle fix on
mainwithout 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)1. …Fixes #1257
Related: #1339