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

Add checks for sorting versions #6088

Merged
merged 1 commit into from
Sep 18, 2024
Merged

Add checks for sorting versions #6088

merged 1 commit into from
Sep 18, 2024

Conversation

JKarlavige
Copy link
Collaborator

@JKarlavige JKarlavige commented Sep 18, 2024

What are you changing in this pull request and why?

On the live site, the following page is crashing: https://docs.getdbt.com/docs/use-dbt-semantic-layer/exports

The error is: e.split is not a function

This is occurring due to a check not being available when the firstVersion prop is set on the VersionBlock component without a version value: <VersionBlock firstVersion lastVersion="1.7">. This causes the firstVersion to be true. The new sortVersions method then tries to use .split, which is not available for booleans.

This PR adds two additional checks to ensure the firstVersion (and lastVersion) are converted to the proper types before .split is run when sorting the versions.

Previews

Verify the page no longer crashes, and verify the VersionBlock components correctly show/hide content based on the selected version (page markdown here):
https://docs-getdbt-com-git-fix-page-crash-dbt-labs.vercel.app/docs/use-dbt-semantic-layer/exports

@JKarlavige JKarlavige requested a review from a team as a code owner September 18, 2024 14:01
Copy link

vercel bot commented Sep 18, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
docs-getdbt-com ✅ Ready (Inspect) Visit Preview Sep 18, 2024 2:02pm

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This should always ensure the first & last versions are not booleans when passed into the sortVersions method.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

This is an additional check just in case a version is not a string before trying to split the string.

Copy link
Contributor

@john-rock john-rock left a comment

Choose a reason for hiding this comment

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

lgtm! Confirmed exports page no longer crashes.

@JKarlavige JKarlavige merged commit f639bb1 into current Sep 18, 2024
10 checks passed
@JKarlavige JKarlavige deleted the fix-page-crash branch September 18, 2024 15:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
size: small This change will take 1 to 2 days to address
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants