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

feat(docs-page): strip tfe version from pathparams #631

Merged
merged 2 commits into from
Jun 30, 2022

Conversation

thiskevinwang
Copy link
Contributor

@thiskevinwang thiskevinwang commented Jun 30, 2022

🎟️ Asana Task
πŸ” Preview Link


Description

This fixes a bug where a frontend URL was being converted to an incorrect content API url

[GET] /enterprise/v202206-1/support
10:36:18:02
2022-06-30T14:36:18.253Z	e224ee77-631b-4fc5-a2ce-f47460eec718	ERROR	Failed to generate static props: ContentApiError: Failed to fetch: https://content.hashicorp.com/api/content/ptfe-releases/doc/v2022.6.1/enterprise/v202206-1/support
    at fetchDocument (/var/task/.next/server/chunks/935.js:12159:15)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)
    at async RemoteContentLoader.loadStaticProps (/var/task/.next/server/chunks/935.js:12767:41)
    at async getStaticProps (/var/task/.next/server/chunks/935.js:12849:31)
    at async getStaticProps (/var/task/.next/server/pages/enterprise/[[...page]].js:84:17)
    at async Object.renderToHTML (/var/task/node_modules/next/dist/server/render.js:470:20)
    at async doRender (/var/task/node_modules/next/dist/server/base-server.js:867:38)
    at async cacheEntry.responseCache.get.isManualRevalidate.isManualRevalidate (/var/task/node_modules/next/dist/server/base-server.js:966:28)
    at async /var/task/node_modules/next/dist/server/response-cache.js:72:36 {
  status: 404

PR Checklist πŸš€

Items in this checklist may not may not apply to your PR, but please consider each item carefully.

  • Add Asana and Preview links above.
  • Conduct thorough self-review.
  • Add or update tests as appropriate.
  • Conduct reasonable cross browser testing for both compatibility and responsive behavior (We have a Sauce Labs account for this, if you don't have access, just ask!).
  • Conduct reasonable accessibility review (use the WAS as a guide or an axe browser plugin until we establish more formal checks).
  • Identify (in the description above) and document (add Asana tasks on this board) any technical debt that you're aware of, but are not addressing as part of this PR.

@changeset-bot
Copy link

changeset-bot bot commented Jun 30, 2022

πŸ¦‹ Changeset detected

Latest commit: d969f46

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@hashicorp/react-docs-page Minor

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@vercel
Copy link

vercel bot commented Jun 30, 2022

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Updated
react-components βœ… Ready (Inspect) Visit Preview Jun 30, 2022 at 3:08PM (UTC)

@thiskevinwang thiskevinwang added the release:canary Triggers a canary release for commits to this pull request label Jun 30, 2022
@github-actions
Copy link
Contributor

πŸ“¦ Canary Packages Published

Latest commit: d969f46

Published 1 packages

@hashicorp/react-docs-page@17.1.0-canary-20220630150904

npm install @hashicorp/react-docs-page@canary

@thiskevinwang thiskevinwang marked this pull request as ready for review June 30, 2022 15:29
@thiskevinwang thiskevinwang requested a review from a team June 30, 2022 15:30
Copy link
Contributor

@zchsh zchsh left a comment

Choose a reason for hiding this comment

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

This looks good to me!

Full transparency: I'm definitely leaning on the presence of tests for stripVersionFromPathParams in this review. The revised REGEX and TFE_REGEX both make sense to me, but can't say I understand the previous REGEX very well 😬

@@ -1,5 +1,5 @@
const REGEX =
/^v([0-9]+)\.([0-9]+)\.(x|[0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/i
Copy link
Contributor

Choose a reason for hiding this comment

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

Are we potentially losing anything by simplifying this regex? πŸ’­

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@zchsh @BRKalow the REGEX before this PR was potentially an oversight. It'd match semvers w/ RC suffixes, like v1.2.3-rc.1.

The -rc.1 suffix is what we'd lose by simplifying the regex

Copy link
Contributor

Choose a reason for hiding this comment

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

Makes sense! Just a future thought, if/when we support pre-releases we might have to bring this back (no action needed now)

@thiskevinwang thiskevinwang merged commit ce6cfd8 into main Jun 30, 2022
@thiskevinwang thiskevinwang deleted the kevin/parse-tfe-version-2 branch June 30, 2022 16:45
@hashibot-web hashibot-web mentioned this pull request Jun 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
release:canary Triggers a canary release for commits to this pull request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants