Skip to content

Comments

don't include button if no link#422

Merged
meganrm merged 2 commits intomainfrom
fix/remove-button
Feb 17, 2026
Merged

don't include button if no link#422
meganrm merged 2 commits intomainfrom
fix/remove-button

Conversation

@meganrm
Copy link
Collaborator

@meganrm meganrm commented Feb 16, 2026

Problem

closes #244

Solution

Check that an href exists

Type of change

Please delete options that are not relevant.

  • Bug fix (non-breaking change which fixes an issue)

Steps to Verify:

@netlify
Copy link

netlify bot commented Feb 16, 2026

Deploy Preview for cell-catalog ready!

Name Link
🔨 Latest commit 7064aa1
🔍 Latest deploy log https://app.netlify.com/projects/cell-catalog/deploys/699377b704a9c90008e93238
😎 Deploy Preview https://deploy-preview-422--cell-catalog.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR fixes a bug where buttons without valid links were being displayed to users. When certificate links (Certificate of Analysis or hPSCreg Certificate) are empty, the buttons should not be rendered at all rather than showing non-functional buttons.

Changes:

  • Modified getDefaultButton helper function to return null when href is empty/falsy
  • Converted the arrow function from implicit return (using parentheses) to explicit return (using braces) to add the conditional check

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +55 to +62
const getDefaultButton = (label: string, href: string) => {
if (!href) {
return null;
}
return (
<DefaultButton
key={href}
href={href}
Copy link

Copilot AI Feb 16, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

getDefaultButton now explicitly handles missing/empty href, but its signature still requires href: string. To align the typing with the intended behavior (and allow callers to pass through nullable/optional data without type assertions), consider changing the parameter type to href?: string (or string | null | undefined) and, if frontmatter can contain whitespace-only values, treating href.trim() as empty too.

Suggested change
const getDefaultButton = (label: string, href: string) => {
if (!href) {
return null;
}
return (
<DefaultButton
key={href}
href={href}
const getDefaultButton = (label: string, href?: string | null) => {
const normalizedHref = href && href.trim();
if (!normalizedHref) {
return null;
}
return (
<DefaultButton
key={normalizedHref}
href={normalizedHref}

Copilot uses AI. Check for mistakes.
Copy link
Collaborator

@rugeli rugeli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

checked both disease and original lines, particularly 122 and 120 (the ones without hPSCreg links), and the buttons are displaying/hidden as expected!

While reviewing, I noticed one field name inconsistency between md files and config (eu_hpsc_reg vs hPSCreg_certificate_link), I'll fix it separately.

@meganrm meganrm merged commit 7f42fd2 into main Feb 17, 2026
13 checks passed
@meganrm meganrm deleted the fix/remove-button branch February 17, 2026 22:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stopgap- remove button

3 participants