-
-
Notifications
You must be signed in to change notification settings - Fork 10.6k
Issue with <Miss /> and SCu interference #4035
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
Comments
I think there must still be some context changes propagating down causing re-renders - which means |
When I added the |
I was playing around with this example yesterday and I'm still not 100% sure it's the lack of |
Ok here's what I've done/found in the above example when clicking on the '404' link.
Rendering tree looks roughly like this:
Without a
|
thanks, this is great, I'll take a look soon |
@alisd23 think you can make a failing test first? |
Yep I'll create one tomorrow |
@ryanflorence I think the <MatchGroup>
<Match pattern='/' component={Home} />
<Miss component={NotFound} />
</MatchGroup> Maybe worth creating an issue for |
I took a stab at this by making sure that the |
@pshrmn Looks like a good way to go! I've been playing around with some scenarios with your fork, and there's a few other cases to consider - but they are solvable. Also there's some general things to review. Maybe worth putting in a pull request as a [WIP](work in progress) so we can start reviewing specific things and discuss cases that need to be covered? |
I ran into this issue when following the ambiguous matches example. For those who need a workaround, this is what I am doing. Failing ambiguous match <Match pattern='/projects/:projectName' render={(matchprops) => (
<div>
<Match pattern='/projects/new' component={ProjectCreatePage} />
<Match pattern='/projects/:projectName/versions' component={ProjectVersionsPage} />
<Match pattern='/projects/:projectName/settings' component={ProjectSettingsPage} />
<Match pattern='/projects/:projectName/collaborators' component={ProjectMemberPage} />
<Miss render={() => <ProjectEditPage {...matchprops} />} />
</div>
)} /> Working ambiguous match <Match pattern='/projects/:projectName' render={(matchprops) => (
matchprops.params.projectName === 'new'
? <ProjectCreatePage {...matchprops} />
: <ProjectEditPage {...matchprops} />
)} />
<Match pattern='/projects/:projectName/versions' component={ProjectVersionsPage} />
<Match pattern='/projects/:projectName/settings' component={ProjectSettingsPage} />
<Match pattern='/projects/:projectName/collaborators' component={ProjectMemberPage} /> |
sCU is fixed in miss 3423b1d (but not released yet) |
This is definitely still failing with In particular try clicking |
Summarizing previous findings: The underlying issue here is that on location change However we can't guarantee that all of the NB: |
I just did some investigating as well, and can mostly confirm what @alisd23 said here. One remark about the blocker case though: Not considering the outdated match state passed to So even if The only way I see this work is to have I'm a big fan of plan B ( |
|
There seems to be an issue with the publish/subscribe functionality when rendering misses and registering matches. because if an element returns
false
fromshouldComponentUpdate
it prevents theMiss
rendering until the next time the location changes.In this simplest case:
I recreated it on codepen to test it too
Miss
does not render on transition to/not-a-route
, but when transitioning BACK to/
it renders (incorrectly). It always seems to be 1 route behind.So far I've tracked it down to the fact that the top level
<MatchProvider />
(insideStaticRouter
) callsnotifySubscribers
before<Match />
callsremoveMatch
on the match context here, because it unmounts after the top level<MatchProvider />
updates.The text was updated successfully, but these errors were encountered: