Skip to content
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: Prev Next Link incorrectly linking to "Nightly Builds" page by d… #3220

Merged
merged 1 commit into from
Sep 27, 2024

Conversation

anantoghosh
Copy link
Contributor

@anantoghosh anantoghosh commented Sep 6, 2024

Issue

Currently, on many handbook pages, the "Previous" and "Next" link blocks at the bottom of the page incorrectly point to the "Nightly Builds" page by default when there should be no link at all.

For example:

image


Cause

This issue occurs due to the context variables previousID and nextID being passed as undefined when no relevant links are found.
These variables are used in the eq filter here:

The context variables are set here:

Gatsby's graphql query explicitly only handles string, number, boolean and null values in eq. When undefined is passed, the filter gets ignored, which in this case results in the "Nightly Builds" page being linked by default.

GraphQL explorer output:

  • When undefined is passed
    image

  • When null is passed
    image


Solution

This PR resolves the issue by setting the previousID and nextID variables to null by default instead of undefined. If the next or previous page is found, these variables will be updated accordingly; otherwise, they remain null.

Fixed handbook/intro.html:
image

@jakebailey jakebailey added the deploy-preview Enables automatic deployments to preview environments on a PR label Sep 6, 2024
@jakebailey jakebailey merged commit 212a05f into microsoft:v2 Sep 27, 2024
8 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
deploy-preview Enables automatic deployments to preview environments on a PR
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants