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

Fixed bug causing routes not to render on change #224

Merged
merged 2 commits into from
Feb 29, 2024

Conversation

AlexanderKaran
Copy link
Collaborator

@AlexanderKaran AlexanderKaran commented Feb 29, 2024

Fixes: #224

  • Fixed broken useEffect that was stopping correct rendering in <StrictMode>
  • Updated examples to use the new React18 rendering method
  • Add strict mode options to the integration tests

I did notice that the Hydration example is broken (even before the changes). I logged a bug for this: #223

@AlexanderKaran AlexanderKaran linked an issue Feb 29, 2024 that may be closed by this pull request
throw new Error('No root element found to render basic routing example');

const root = createRoot(container);
root.render(<App />);
Copy link
Collaborator

Choose a reason for hiding this comment

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

How are we testing if it works with StrictMode ?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

See integration tests file

Copy link
Collaborator

Choose a reason for hiding this comment

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

yeahhh, I was looking at it now

pancaspe87
pancaspe87 previously approved these changes Feb 29, 2024
@@ -15,13 +15,13 @@ export const Router = ({
onPrefetch,
routes,
}: RouterProps) => {
useEffect(() => {
const { unlisten } = getRouterState();
const { unlisten } = getRouterState();
Copy link
Collaborator

Choose a reason for hiding this comment

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

Fine, even if I think the problem is the use of getRouterState which is bad (as out of react control flow)

@JohnsonChauAtlassian
Copy link

Cloned locally and confirmed that it works with/without strict mode in R18 concurrent mode for basic-routing example

@AlexanderKaran AlexanderKaran merged commit a00d5b3 into master Feb 29, 2024
3 checks passed
@AlexanderKaran AlexanderKaran deleted the 222-doesnt-not-work-with-react-18-strictmodel branch February 29, 2024 04:49
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.

Doesn't not work with React 18 StrictModel
4 participants