-
Notifications
You must be signed in to change notification settings - Fork 386
Conversation
There is an edge case where `params.asPath === '/'` and gets converted to `{'/': null}` as search state. Checking that we have an `?` before fix this issue.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, support question
const searchState = qs.parse( | ||
params.asPath.substring(params.asPath.indexOf('?') + 1) | ||
); | ||
const searchState = params.asPath.includes('?') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
.includes is not supported everywhere we support. I think you should do indexOf('?') > -1
😄
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this context with nextjs and babel is it safe to use .includes
👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
available in evergreen browsers, always check https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/String/includes#Browser_compatibility. So it's good
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I forgot that this was node-only
Deploy preview ready! Built with commit a3c96e0 |
<a name="4.1.0-beta.4"></a> # [4.1.0-beta.4](v4.1.0-beta.3...v4.1.0-beta.4) (2017-08-03) ### Bug Fixes * **deps:** Update dependency lint-staged to version ^4.0.0 (#201) ([6867a1b](6867a1b)) * **nextjs/ssr:** parse `params.asPath` (#189) ([ae17da0](ae17da0)) * **PoweredBy:** add a label to the Algolia logo (#216) ([cd235bd](cd235bd)) * **react:** remove typo around `"" 2` (#220) ([f73eb04](f73eb04)) * **ScrollTo:** scroll to only if change triggered by the widget observed (#202) ([2d76022](2d76022)) * **theme:** format the count of items appearing in a refinement (#217) ([2225c24](2225c24))
<a name="4.1.0-beta.4"></a> # [4.1.0-beta.4](v4.1.0-beta.3...v4.1.0-beta.4) (2017-08-03) ### Bug Fixes * **deps:** Update dependency lint-staged to version ^4.0.0 (#201) ([6867a1b](6867a1b)) * **nextjs/ssr:** parse `params.asPath` (#189) ([ae17da0](ae17da0)) * **PoweredBy:** add a label to the Algolia logo (#216) ([cd235bd](cd235bd)) * **react:** remove typo around `"" 2` (#220) ([f73eb04](f73eb04)) * **ScrollTo:** scroll to only if change triggered by the widget observed (#202) ([2d76022](2d76022)) * **theme:** format the count of items appearing in a refinement (#217) ([2225c24](2225c24))
<a name="4.1.0-beta.4"></a> # [4.1.0-beta.4](v4.1.0-beta.3...v4.1.0-beta.4) (2017-08-03) ### Bug Fixes * **deps:** Update dependency lint-staged to version ^4.0.0 (#201) ([6867a1b](6867a1b)) * **nextjs/ssr:** parse `params.asPath` (#189) ([ae17da0](ae17da0)) * **PoweredBy:** add a label to the Algolia logo (#216) ([cd235bd](cd235bd)) * **react:** remove typo around `"" 2` (#220) ([f73eb04](f73eb04)) * **ScrollTo:** scroll to only if change triggered by the widget observed (#202) ([2d76022](2d76022)) * **theme:** format the count of items appearing in a refinement (#217) ([2225c24](2225c24))
There is an edge case where
params.asPath === '/'
and gets converted to{'/': null}
as search state.Checking that we have an
?
before fix this issue.