Skip to content

Commit

Permalink
Fixes navigate
Browse files Browse the repository at this point in the history
  • Loading branch information
vwraposo committed Aug 22, 2019
1 parent 5d5d002 commit cef76d5
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 13 deletions.
23 changes: 11 additions & 12 deletions react/utils/pages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -247,19 +247,18 @@ export function navigate(
const realHash = is(String, hash) ? `#${hash}` : ''
const query = inputQuery || realQuery

const internalRoute = page
const navigationRoute = page
? getRouteFromPageName(page, pages, params)
: getRouteFromPath(to, pages, query, realHash)
const navigationRoute = internalRoute || { path: to, params: {}, id: '' }

// if (!navigationRoute) {
// console.warn(
// `Unable to find route for ${
// page ? `page '${page}' and the passed parameters` : `path '${to}'`
// }`
// )
// return false
// }
: { path: to, params: {}, id: '' }

if (!navigationRoute) {
console.warn(
`Unable to find route for ${
page ? `page '${page}' and the passed parameters` : `path '${to}'`
}`
)
return false
}

// Prefix any non-absolute paths (e.g. http:// or https://) with runtime.rootPath
if (rootPath && !navigationRoute.path.startsWith('http')) {
Expand Down
2 changes: 1 addition & 1 deletion react/utils/routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ export const fetchNavigationPage = ({
query: string
}) => {
console.log({ query })
return fetch(`${path}?${query}&__pickRuntime=${runtimeFields}`)
return fetch(`${path}?__pickRuntime=${runtimeFields}${query && '&' + query}`)
.then(response => response.json())
.then(parsePageQueryResponse)
}
Expand Down

0 comments on commit cef76d5

Please sign in to comment.