NutsNews iOS — Story Notes Stable Key Patch
Section titled “NutsNews iOS — Story Notes Stable Key Patch”This patch fixes story notes so a note is attached to the same article no matter where the article is opened from.
Problem fixed
Section titled “Problem fixed”Before this patch, notes were keyed by article.id. Different screens can build the same article with different IDs:
- Home feed may use the database row ID.
- Saved Stories uses the original URL as the stable saved ID.
- Search and native recommendation screens may have their own article object.
That means a note saved from one entry point could disappear when opening the same story from Search, Saved Stories, Good Mood, or Today’s Picks.
StoryNoteStore now uses LikedStoryStore.stableID(for:), which prefers the original story URL, then falls back to the row ID, then the title.
The patch also keeps backward compatibility by reading old notes saved under article.id and migrating them to the stable key the next time the note is saved.
Files changed
Section titled “Files changed”NutsNews/NutsNews/Models/StoryNoteStore.swiftTest checklist
Section titled “Test checklist”- Open a story from Home and save a note.
- Open the same story from Saved Stories and confirm the note appears.
- Edit the note from Saved Stories and save.
- Reopen the story from Home and confirm the edit appears.
- Open a story from Search and save a note.
- Save that story.
- Open it from Saved Stories and confirm the note appears.
- Open a story from Today’s Picks / Good Mood and save a note.
- Reopen from another screen and confirm the note appears.
- Clear a note from any screen and confirm it is cleared everywhere.
