Rememes - Media Sizes - Notification fixes#2375
Conversation
Signed-off-by: prxt6529 <prxt@6529.io>
📝 WalkthroughWalkthroughThis PR adds an ChangesIntrinsic Image Height Feature
AllDrops Notification Vote Context
Rememe Submission API Migration
Rememes Component Fetch/URL/Filter Refactoring
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
Suggested reviewers
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
Actionable comments posted: 2
🧹 Nitpick comments (1)
__tests__/components/DropListItemContentMediaImage.test.tsx (1)
91-103: ⚡ Quick winAdd a regression test for intrinsic error handling when
primarySrcequalssrc.This test suite currently misses the failure mode where fallback swapping is a no-op; adding that case would lock in retry/error behavior for intrinsic mode.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@__tests__/components/DropListItemContentMediaImage.test.tsx` around lines 91 - 103, Add a regression test in __tests__/components/DropListItemContentMediaImage.test.tsx that simulates an image load error when primarySrc === src and intrinsicHeight is true; specifically add an it block referencing the DropListItemContentMediaImage component with props src and primarySrc set to the same value and intrinsicHeight, trigger an error event on the rendered img and assert that the fallback swap is a no-op (no infinite retry) and the component transitions to the expected error/fallback state (e.g., shows the fallback UI or sets an error flag) rather than repeatedly attempting to swap sources; this ensures intrinsic error handling when primarySrc equals src is covered.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@__tests__/services/api/notifications-v2-api.test.ts`:
- Around line 234-237: The assertion using toMatchObject allows extra keys in
additional_context (e.g., vote) to slip through; update the test that inspects
the notification variable so it performs a strict check on
additional_context—either replace the toMatchObject check with a direct equality
assertion on notification?.additional_context toEqual({}) or add an explicit
assertion that notification?.additional_context does not have the "vote"
property (not.toHaveProperty("vote")) to ensure vote isn't being added when not
provided.
In `@components/drops/view/item/content/media/DropListItemContentMediaImage.tsx`:
- Around line 135-143: The intrinsic error handler (handleIntrinsicImageError)
currently swaps to a fallback by toggling usedFallback and setCurrentSrc(src)
even when the primary/fallback URL equals the current src, which prevents
advancing retry/error state; change the logic so that when !usedFallback you
only call setCurrentSrc/setUsedFallback if the fallback URL is different from
the current src (compare primarySrc or fallbackSrc to src), otherwise call
handleError() immediately to advance retry state; update the dependency array to
include any new symbols you reference (e.g., primarySrc or fallbackSrc) and keep
references to setCurrentSrc, setUsedFallback, usedFallback, handleError intact.
---
Nitpick comments:
In `@__tests__/components/DropListItemContentMediaImage.test.tsx`:
- Around line 91-103: Add a regression test in
__tests__/components/DropListItemContentMediaImage.test.tsx that simulates an
image load error when primarySrc === src and intrinsicHeight is true;
specifically add an it block referencing the DropListItemContentMediaImage
component with props src and primarySrc set to the same value and
intrinsicHeight, trigger an error event on the rendered img and assert that the
fallback swap is a no-op (no infinite retry) and the component transitions to
the expected error/fallback state (e.g., shows the fallback UI or sets an error
flag) rather than repeatedly attempting to swap sources; this ensures intrinsic
error handling when primarySrc equals src is covered.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 68834a90-6d48-43b6-ab8e-3caab6e11350
📒 Files selected for processing (14)
__tests__/components/DropListItemContentMediaImage.test.tsx__tests__/components/brain/notifications/all-drops/NotificationAllDrops.test.tsx__tests__/components/drops/view/part/DropPartMarkdownImage.test.tsx__tests__/components/rememes/RememeAddPage.test.tsx__tests__/components/rememes/Rememes.test.tsx__tests__/services/api/notifications-v2-api.test.tscomponents/drops/view/item/content/media/DropListItemContentMediaImage.tsxcomponents/drops/view/part/DropPartMarkdownImage.tsxcomponents/rememes/RememeAddComponent.tsxcomponents/rememes/RememeAddPage.tsxcomponents/rememes/Rememes.module.scsscomponents/rememes/Rememes.tsxservices/api/notifications-v2-api.tstypes/feed.types.ts
|



Summary by CodeRabbit
New Features
Bug Fixes
Tests