-
-
Notifications
You must be signed in to change notification settings - Fork 602
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: remove hydration errors #3262
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -87,18 +87,9 @@ export default function FeaturedBlogPost({ post, className = '' }: FeaturedBlogP | |
{post.authors | ||
.map((author, index) => | ||
author.link ? ( | ||
<a | ||
key={index} | ||
data-alt={author.name} | ||
href={author.link} | ||
onClick={(e) => { | ||
e.stopPropagation(); | ||
}} | ||
target='_blank' | ||
rel='noreferrer' | ||
> | ||
<span key={index} data-alt={author.name} rel='noreferrer'> | ||
{author.name} | ||
</a> | ||
</span> | ||
Comment on lines
+90
to
+92
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 💡 Codebase verification Multiple Components Affected by Removal of Author Link Functionality The change to replace author
Impact:
Recommendation: Conduct a comprehensive review of all instances where author links are rendered to assess the necessity of this change and ensure that it aligns with the project's overall goals. If the removal was intentional, consider updating all related components consistently. If not, revert the changes to maintain expected functionality. 🔗 Analysis chainReconsider removing author link functionality The change from an anchor tag to a span for author names with links removes important functionality:
Additionally, the removal of the onClick event handler that prevented event propagation might lead to unintended behavior, such as triggering the parent Link component's click event when clicking on an author name. Consider reverting this change to maintain the original functionality. If there were specific issues with the previous implementation, address them directly rather than removing the feature entirely. Here's a suggested fix: - <span key={index} data-alt={author.name} rel='noreferrer'>
- {author.name}
- </span>
+ <a
+ key={index}
+ href={author.link}
+ target="_blank"
+ rel="noreferrer"
+ onClick={(e) => e.stopPropagation()}
+ >
+ {author.name}
+ </a> This preserves the original functionality while ensuring that clicks on author names don't trigger the parent Link component's click event. To ensure this change doesn't break any existing functionality, please run the following verification script: This will help identify if similar changes need to be made elsewhere in the codebase. Correcting the search script for author link rendering patterns Update the search script using file extension glob patterns Refine the search pattern to capture all relevant author link occurrences 🏁 Scripts executedThe following scripts were executed for the analysis: Script: #!/bin/bash
# Description: Check for any other occurrences of author link rendering in the codebase
# Test: Search for similar author link rendering patterns
rg --type typescript --type tsx 'author\.link.*?\{.*?author\.name' -g '!components/newsroom/FeaturedBlogPost.tsx'
Length of output: 150 Script: #!/bin/bash
# Description: Check for any other occurrences of author link rendering in the codebase
# Test: Search for similar author link rendering patterns
rg --type ts --type tsx 'author\.link.*?\{.*?author\.name' -g '!components/newsroom/FeaturedBlogPost.tsx'
Length of output: 135 Script: #!/bin/bash
# Description: Check for any other occurrences of author link rendering in the codebase
# Test: Search for similar author link rendering patterns
rg -g '*.{ts,tsx}' 'author\.link.*?\{.*?author\.name' -g '!components/newsroom/FeaturedBlogPost.tsx'
Length of output: 102 Script: #!/bin/bash
# Description: Search for any occurrences of 'author.link' or 'author.name' in the codebase excluding the specified file
# Search for 'author.link' or 'author.name' in TypeScript and TSX files
rg -g '*.{ts,tsx}' '(author\.link|author\.name)' -g '!components/newsroom/FeaturedBlogPost.tsx'
Length of output: 833 |
||
) : ( | ||
author.name | ||
) | ||
|
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.
Remove unnecessary Fragment
The use of
<React.Fragment>
is unnecessary when there's only one child element.Simplify the code by removing the Fragment:
This change aligns with the static analysis hint and improves code clarity.
📝 Committable suggestion
🧰 Tools
🪛 Biome