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: ignore queries while switching platform #4730

Merged
merged 2 commits into from
Oct 20, 2022

Conversation

5d
Copy link
Member

@5d 5d commented Oct 20, 2022

Issue #, if available:

#4729

Description of changes:

  • extract current pathname from window.location

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@5d 5d requested a review from a team as a code owner October 20, 2022 18:50
@@ -28,7 +28,7 @@ const getFirstPathSegment = (path: string): string | undefined => {
const multiLibVersionPlatforms = ['ios']

const convertToRouteHerf = (filter: FilterSelectProps, targetFilterKey: string) => {
let path = filter.url
let path = window.location.pathname
Copy link
Contributor

@jacoblogan jacoblogan Oct 20, 2022

Choose a reason for hiding this comment

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

using the window object throws a build error, how about we just strip out the query parameters

// remove search query string when switching between platforms/frameworks
  let path =
    filter.url && filter.url.split ? filter.url.split('?')[0] : filter.url;

Copy link
Member Author

Choose a reason for hiding this comment

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

thanks, @jacoblogan
I also found the fragment # in the url also could cause the same issue. So I fallback to construct a URL to extract the pathname from it.

@5d 5d requested a review from jacoblogan October 20, 2022 19:41
Copy link
Contributor

@jacoblogan jacoblogan left a comment

Choose a reason for hiding this comment

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

LGTM

@katiegoines katiegoines merged commit 39137a1 into main Oct 20, 2022
@katiegoines katiegoines deleted the 5d/fix-pathname-with-queries branch October 20, 2022 19:46
rachelnabors pushed a commit that referenced this pull request Oct 21, 2022
* fix: ignore queries while switching platform

* fix: nextjs build failed with global object 'window'
rachelnabors added a commit that referenced this pull request Oct 21, 2022
* removes ionic

* scours away ionic files

* Remove typo

* reverting yarn upgrade. we need to update the yarn lock

* Fixed type for Auth.federatedSignIn() in lib/auth/js/social (#4699)

* Fix lib-v1 error where refresh on root gave 404 (#4722)

Co-authored-by: Thomas Leing <[email protected]>

* fix: edits to next.js getting started to bring it current (#4672)

* fix: edits to next.js getting started to bring it current

* updates to next.js hosting content

* Removing Responsive Components from directory

* Updating responsive documentation

* improved docs for responsive components

* Updating responsive documentation

* merging

* Adding link to theme

* minor fix

* another minor fix

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update src/pages/console/uibuilder/responsive.mdx

Co-authored-by: Rene Brandel <[email protected]>

* Update cspell.json

* requested edits to documentation

* Update cspell.json

* Add Android dev-preview files back (#4727)

Co-authored-by: Thomas Leing <[email protected]>

* Update versions.ts

* fix: ignore queries while switching platform (#4730)

* fix: ignore queries while switching platform

* fix: nextjs build failed with global object 'window'

* Getting Started Tutorial : React update (#4676)

* clarifying this needs a new terminal

* updates

* Update src/fragments/start/getting-started/common/prereq.mdx

Co-authored-by: siegerts <[email protected]>

* Update src/fragments/start/getting-started/react/api.mdx

Co-authored-by: siegerts <[email protected]>

* updating per review

Co-authored-by: siegerts <[email protected]>

* Facebook OAuth steps update (#4731)

* Fixed type for Auth.federatedSignIn() in lib/auth/js/social

* Fix facebook oauth setup steps

* fix: add section to clarify steps to update Cognito user email address with example (#4476)

* fix: add section to clarify steps to update Cognito user email address with example

Related to:
aws-amplify/amplify-js#987
aws-amplify/amplify-cli#10773

* remove extra space

* React native getting started guide updates (#4714)

* small updates to getting started guide

* clarified the inspector panel location

* Expo CLI wording update

* remove react-native-picker and react-native package

* update to RN getting started guide

* updated installation of React Native CLI

* update setup steps

* removed broken closing tags

* fixed tag

* removed open tag without closing tag

* added closing tag

* removes ionic

* omg merge conflict merginng. Much shame. Very sad.

Co-authored-by: Tim Nguyen <[email protected]>
Co-authored-by: Dan Kiuna <[email protected]>
Co-authored-by: Thomas Leing <[email protected]>
Co-authored-by: Thomas Leing <[email protected]>
Co-authored-by: Kevin Old <[email protected]>
Co-authored-by: wpeck-amplify <[email protected]>
Co-authored-by: wrpeck <[email protected]>
Co-authored-by: Rene Brandel <[email protected]>
Co-authored-by: dengdan154 <[email protected]>
Co-authored-by: Di Wu <[email protected]>
Co-authored-by: siegerts <[email protected]>
Co-authored-by: Abdallah Shaban <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants