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(RemoteContentLoader): navDataPrefix option #583

Merged
merged 4 commits into from
May 5, 2022

Conversation

thiskevinwang
Copy link
Contributor

@thiskevinwang thiskevinwang commented May 5, 2022

Description

This adds a navDataPrefix option to our RemoteContentLoader.

This helps to address a previous assumption that basePath would always be the same for doc and nav-data lookups from our API, which is not necessarily going to be the case going forward.

🎟️ Asana Task
🔍 Preview Link


Description

Describe this pull request: what is it aiming to achieve? What should someone reviewing this PR know? If this PR includes visual changes, consider including before / after screenshots, or an animated gif showing interactions.

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.

@vercel
Copy link

vercel bot commented May 5, 2022

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

Name Status Preview Updated
react-components ✅ Ready (Inspect) Visit Preview May 5, 2022 at 9:41PM (UTC)

@changeset-bot
Copy link

changeset-bot bot commented May 5, 2022

🦋 Changeset detected

Latest commit: 445d4fb

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

@BRKalow
Copy link
Contributor

BRKalow commented May 5, 2022

Ah I see now. So generally it's {basePath}-nav-data.json, but we need a way to change that. :nod:

@@ -95,22 +104,28 @@ export default class RemoteContentLoader implements DataLoader {
if (!this.opts.mainBranch) this.opts.mainBranch = 'main'
if (!this.opts.scope) this.opts.scope = {}
if (!this.opts.remarkPlugins) this.opts.remarkPlugins = []

this.navDataPrefix = this.opts.navDataPrefix || this.opts.basePath
Copy link
Contributor

Choose a reason for hiding this comment

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

suggestion: convention is for everything to be read from this.opts, so we can use a similar default approach above and assign to this.opts.basePath if it is unset. No need for the extra class property

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Good call! I'll do that

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed the extra property: 445d4fb

@thiskevinwang
Copy link
Contributor Author

Ah I see now. So generally it's {basePath}-nav-data.json, but we need a way to change that. :nod:

Yea, this has been one of those assumptions that hasn't caused issues in the past, but not sort of does

@thiskevinwang thiskevinwang requested a review from BRKalow May 5, 2022 21:40
@thiskevinwang thiskevinwang added the release:canary Triggers a canary release for commits to this pull request label May 5, 2022
Copy link
Contributor

@BRKalow BRKalow left a comment

Choose a reason for hiding this comment

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

LGTM!

@github-actions
Copy link
Contributor

github-actions bot commented May 5, 2022

📦 Canary Packages Published

Latest commit: 445d4fb

Published 1 packages

@hashicorp/react-docs-page@16.1.0-canary-20220505214234

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

@thiskevinwang thiskevinwang merged commit 27a251e into main May 5, 2022
@thiskevinwang thiskevinwang deleted the kevin/docs-page-nav-data-prefix branch May 5, 2022 21:55
@hashibot-web hashibot-web mentioned this pull request May 6, 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

2 participants