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

Routes change in browser location, but content does not change (even though found render fires) #1050

Closed
rosskevin opened this issue Jun 28, 2023 · 2 comments

Comments

@rosskevin
Copy link
Contributor

We have just upgraded an application that has been running successfully for years with found.

It is now using react: 18.2.0, found: 1.3.0 and we did switch our build to vite. I have tried this with and without strict mode based on @jquense comment in #968, but there is no change. I reviewed #961 but the only similarity there is we are both using vite. I reviewed the changelog but did not spot anything I am missing.

Symptoms:

  • any page you go to directly and hit return in the location bar renders fine
  • click any link and I have verified in the debugger it sends the correct information to found to change
  • url in the browser location changes
  • I see the found renderFn and graphql queries fire; but
  • it stays on the same page

Attempts include strict mode on/off, add/remove hotRouteConfig, remove found-scroll (seems to be falling behind), but no changes. Each page works, it will just not render after click of a link (only browser location bar change).

I've boiled down my router config to:

import {
  BrowserRouterOptions,
  createBrowserRouter,
  createRender,
  makeRouteConfig,
  RenderArgs,
} from 'found'
import * as React from 'react'

export function createRouter(routes: React.ReactNode, options?: BrowserRouterOptions) {
  const renderFn = createRender({})

  const defaultConfig = {
    historyOptions: { useBeforeUnload: true },
    render: (renderArgs: RenderArgs) => renderFn(renderArgs),
    routeConfig: makeRouteConfig(routes),
  }
  const config = { ...defaultConfig, ...(options || {}) }
  return createBrowserRouter(config)
}

I'm still looking but appreciate any pointers.

@rosskevin
Copy link
Contributor Author

I'm going to close this for the moment - I just found a top level route that works and it is leading me to believe we are likely to have a problem in our route config.

@rosskevin
Copy link
Contributor Author

Just to close this loop, we did some optimization of an <AppContent/> and <AppFrame/> components at the top level with React.memo and a custom comparator. The condition was inverted and therefore caused the content from the Component on the new route pushed to not render because it signaled no need to do so.

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

No branches or pull requests

1 participant