-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: gif in link's name #1703
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: gif in link's name #1703
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughThe changes update the filtering logic for page links related to GIF images in both horizontal and vertical viewer components. The condition now checks whether a link's href ends with ".gif" instead of merely containing ".gif". A minor formatting adjustment was also made to a prop in the horizontal viewer component. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant ViewerComponent
participant PageLinks
User->>ViewerComponent: Render page
ViewerComponent->>PageLinks: Retrieve all links
ViewerComponent->>ViewerComponent: Filter links (href endsWith ".gif" or not)
ViewerComponent->>ViewerComponent: Render clickable areas and overlays based on filtered links
Warning There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure. 🔧 ESLint
npm error Exit handler never called! ✨ Finishing Touches
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 0
🧹 Nitpick comments (4)
components/view/viewer/pages-vertical-viewer.tsx (2)
874-874: Consider case‐insensitive matching and query params when filtering non-GIF links.Using
link.href.endsWith(".gif")ignores query strings (e.g.,image.gif?foo=bar) and is case-sensitive. To cover.GIFextensions and URLs with params, normalize the href before checking:-filter((link) => !link.href.endsWith(".gif")) +filter((link) => { + const cleanHref = link.href.split("?")[0].toLowerCase(); + return !cleanHref.endsWith(".gif"); +})
905-906: Apply the same normalization strategy for GIF overlays.Similarly, ensure you strip query params and lowercase the href to reliably detect GIF overlays:
-filter((link) => link.href.endsWith(".gif")) +filter((link) => { + const cleanHref = link.href.split("?")[0].toLowerCase(); + return cleanHref.endsWith(".gif"); +})components/view/viewer/pages-horizontal-viewer.tsx (2)
671-671: Normalize href before filtering non-GIF links.Apply consistent normalization (strip query params + lowercase) here as well to avoid false positives/negatives:
-filter((link) => !link.href.endsWith(".gif")) +filter((link) => { + const cleanHref = link.href.split("?")[0].toLowerCase(); + return !cleanHref.endsWith(".gif"); +})
701-701: Normalize href before selecting GIF overlays.Mirror the normalization logic to ensure accurate detection:
-filter((link) => link.href.endsWith(".gif")) +filter((link) => { + const cleanHref = link.href.split("?")[0].toLowerCase(); + return cleanHref.endsWith(".gif"); +})
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (2)
components/view/viewer/pages-horizontal-viewer.tsx(3 hunks)components/view/viewer/pages-vertical-viewer.tsx(2 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (1)
components/view/viewer/pages-horizontal-viewer.tsx (1)
lib/tracking/tracking-config.ts (1)
getTrackingOptions(17-25)
🔇 Additional comments (1)
components/view/viewer/pages-horizontal-viewer.tsx (1)
833-833: Formatting only:inactivityThresholdprop consolidation.The change consolidates the
inactivityThresholdprop into a single line, improving readability without altering behavior.
Summary by CodeRabbit