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
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions examples/basic-routing/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import { About } from './about';
import { Home } from './home';
Expand Down Expand Up @@ -42,4 +42,9 @@ const App = () => {
);
};

render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container)
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

9 changes: 7 additions & 2 deletions examples/hash-routing/index.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { createHashHistory as createHashHistory4 } from 'history';
import { createHashHistory as createHashHistory5 } from 'history-5';
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import { About } from './about';
import { Home } from './home';
Expand Down Expand Up @@ -42,4 +42,9 @@ const App = () => {
);
};

render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container)
throw new Error('No root element found to render hash routing example');

const root = createRoot(container);
root.render(<App />);
9 changes: 7 additions & 2 deletions examples/hooks/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import { shouldReloadWhenRouteMatchChanges } from '../../src/utils';

Expand Down Expand Up @@ -68,4 +68,9 @@ const App = () => {
);
};

render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container)
throw new Error('No root element found to render hooks example');

const root = createRoot(container);
root.render(<App />);
9 changes: 7 additions & 2 deletions examples/hydration/index.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { createMemoryHistory } from 'history';
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';
import { defaultRegistry } from 'react-sweet-state';

import { homeRoute } from './routes';
Expand Down Expand Up @@ -53,7 +53,12 @@ const main = async () => {
);
};

render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container)
throw new Error('No root element found to render hydration example');

const root = createRoot(container);
root.render(<App />);
};

main();
9 changes: 7 additions & 2 deletions examples/routing-with-resources/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { render } from 'react-dom';
import { createRoot } from 'react-dom/client';

import { homeRoute, aboutRoute } from './routes';

Expand Down Expand Up @@ -28,4 +28,9 @@ const App = () => {
);
};

render(<App />, document.getElementById('root'));
const container = document.getElementById('root');
if (!container)
throw new Error('No root element found to render resources example');

const root = createRoot(container);
root.render(<App />);
Loading
Loading