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(theme): add queryString option to localeDropdown #8915

Merged
merged 2 commits into from
Apr 21, 2023

Conversation

wceolin
Copy link
Contributor

@wceolin wceolin commented Apr 21, 2023

Pre-flight checklist

  • I have read the Contributing Guidelines on pull requests.
  • If this is a code change: I have written unit tests and/or added dogfooding pages to fully verify the new behavior.
  • If this is a new API or substantial change: the PR has an accompanying issue (closes #0000) and the maintainers have approved on my working plan.

Motivation

This PR adds a queryString option to the localeDropdown considering @slorber's review for #5890

Test Plan

@slorber mentioned we should dogfood it but I wasn't sure how do it. I can think of two ways for dogfooding it:

  1. Full integration test that sets the queryString option and uses Netlify Edge Functions to set a cookie to remember a user's preference.
  2. A simpler test to check if the queryString is properly appended to the URL.

I manually tested the following cases:

  • Should add a query string when the config is passed.
  • Should not add a query string when the config is undefined.
  • Should not keep the query string when navigating to another route.

I'm happy to write tests for those cases (and additional ones I didn't think of) but I'll need some pointers on how to get started.

Test links

Deploy preview: https://deploy-preview-8915--docusaurus-2.netlify.app/

Related issues/PRs

#5890
#5839 (reply in thread)

@facebook-github-bot facebook-github-bot added the CLA Signed Signed Facebook CLA label Apr 21, 2023
@netlify
Copy link

netlify bot commented Apr 21, 2023

[V2]

Name Link
🔨 Latest commit 2483389
🔍 Latest deploy log https://app.netlify.com/sites/docusaurus-2/deploys/6442633bdc94ad0008a99816
😎 Deploy Preview https://deploy-preview-8915--docusaurus-2.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 site settings.

@github-actions
Copy link

github-actions bot commented Apr 21, 2023

⚡️ Lighthouse report for the deploy preview of this PR

URL Performance Accessibility Best Practices SEO PWA Report
/ 🟠 75 🟢 97 🟢 92 🟢 100 🟢 90 Report
/docs/installation 🟠 82 🟢 100 🟢 92 🟢 100 🟢 90 Report

@slorber slorber added the pr: new feature This PR adds a new API or behavior. label Apr 21, 2023
Copy link
Collaborator

@slorber slorber left a comment

Choose a reason for hiding this comment

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

Thanks 👍

That looks good enough for me and is not too risky to merge.

We'll look into using this on our own website later and when Netlify edge functions are out of beta

packages/docusaurus-theme-classic/src/theme-classic.d.ts Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed Signed Facebook CLA pr: new feature This PR adds a new API or behavior.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants