Repository navigation
fix(favorites): key card favourites by resource URL, not id - #103
Coder-soft wants to merge 1 commit into
Conversation
Saving a favourite from a resource card never appeared in the Favorites tab for signed-out users (and signed-in users alike). Root cause: ResourceCard keyed favourites by `String(resource.id)` (e.g. "399"), while the Favorites tab, FavoritesSidebar, folder logic and the `user_favorites.resource_url` DB column all key by `getResourceUrl(resource)` (the download URL). The stored key never matched the lookup, so the tab was always empty. Fix: use `getResourceUrl(resource)` in ResourceCard's isFavorited/toggle paths, matching every other consumer. Note: previously-stored favourites were keyed by id and are unreadable, but they never rendered anywhere, so nothing user-visible is lost.
|
@Coder-soft is attempting to deploy a commit to the yamura3's projects Team on Vercel. A member of the Team first needs to authorize it. |
There was a problem hiding this comment.
Your trial has ended. Reactivate Greptile to resume code reviews.
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configuration
📒 Files selected for processing (1)
Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review. 📝 WalkthroughWalkthroughResourceCard now uses each resource’s URL, rather than its stringified ID, to check and toggle its favorite state. ChangesResource favorites
Priority: ⬇️ Low Estimated code review effort: 2 (Simple) | ~8 minutes Change: Bug fix Merge Risk: ⚪ Minimal · up to The URL-less case does not create a malformed favorite, and no other actionable merge risk is established. 🚥 Pre-merge checks | ✅ 4✅ Passed checks (4 passed)✨ Finishing Touches 💡 1🛠️ Fix failing CI checks 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit hops by the resource card Comment |
Same fix as the standalone creatorcluster#103, applied to the redesigned card so the redesign branch does not carry the pre-existing id/URL mismatch.
|
Closing for now — the redesign is being set aside to land as smaller, separate updates. Will revisit later. |
Fixes a pre-existing bug (present on
main, not introduced by the redesign): saving a resource to favourites from a card never showed up in the Favorites tab.Root cause
ResourceCardkeyed favourites byString(resource.id)("399","mcicons-4001"), but every other consumer keys bygetResourceUrl(resource)— the Favorites tab filter,FavoritesSidebar, the folder logic, and theuser_favorites.resource_urlDB column. The two keys never match (ids are numeric /mcicons-*; URLs areraw.githubusercontent.com/...), so the tab was always empty.Verified against the real data: all resources expose a URL, and no
idequals its URL.Fix
ResourceCardnow usesgetResourceUrl(resource)forisFavoritedandtoggleFavorite, matching the rest of the app.Verified
Signed-out flow in the browser: heart a card →
localStorage.rd_guest_favoritesstores the resource URL → Favorites tab renders the card (previously empty).Note
Favourites previously stored under the id key are orphaned, but they never rendered anywhere, so no user-visible data is lost.
Summary by CodeRabbit