Skip to content

Commit 002bfa2

Browse files
authored
Merge pull request #55 from neonexus/master
Fixed Webpack Dev Server reload issue
2 parents 8961cf2 + ec85ce2 commit 002bfa2

File tree

6 files changed

+23
-18
lines changed

6 files changed

+23
-18
lines changed

.idea/dictionaries/neonexusdemortis.xml

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

CHANGELOG.md

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
# Changelog
22

3-
## [v3.0.0-beta](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v2.0.0...v3.0.0-beta.7) (2022-04-13)
3+
## [v3.0.0](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v2.0.0...v3.0.0) (2022-04-13)
4+
5+
### Features
6+
7+
* Fixed the reloading issue when using Webpack Dev Server.
8+
9+
## [v3.0.0-beta](https://github.com/neonexus/sails-react-bootstrap-webpack/compare/v2.0.0...v3.0.0-beta.7) (2022-03-19)
410

511
### Features
612

README.md

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,8 @@ The `master` branch is experimental, and the [release branch](https://github.com
1111

1212
**FINAL WARNING: DO NOT RELY ON THE MASTER BRANCH!**
1313

14-
# v3.0.0-beta Warning
15-
Moving from v5 -> v6 of the [React Router](https://reactrouter.com/) is a serious undertaking (see [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5)).
16-
17-
While basic features have been upgraded to the new standard of the new React Router, there are still some quirks while developing... When the assets are built for remote use (`npm run build` or `npm run build:dev`), everything works as expected; however, when working with the auto-reloading Webpack dev server, if you don't start from a "root" path (like "/admin" or "/main"), and refresh a path like "/admin/dashboard", things will not render.
18-
19-
I'm still working on a fix for this.
14+
# v3.0.0 Warning
15+
Moving from v5 -> v6 of the [React Router](https://reactrouter.com/) can be a serious undertaking (see [the v5 -> v6 migration guide](https://reactrouter.com/docs/en/v6/upgrading/v5)).
2016

2117
If you would like to use v5 of React Router, make sure you are cloning [v2 of this repo](https://github.com/neonexus/sails-react-bootstrap-webpack/tree/v2.0.0).
2218

assets/src/index.jsx

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import React from 'react';
1+
import React, {Suspense} from 'react';
22
import {createRoot} from 'react-dom/client';
33
import {
44
BrowserRouter as Router,
@@ -15,14 +15,16 @@ function IndexApp() {
1515
// Sails will handle the webapp redirects in remote configurations.
1616
return (
1717
<Router>
18-
<Routes>
19-
<Route path="/admin/*" element={<AdminRouter />} />
20-
<Route index path="/main/*" element={<Main />} />
21-
<Route path="/" element={<Navigate to="/main" />} />
22-
</Routes>
18+
<Suspense fallback={<div>Loading...</div>}>
19+
<Routes>
20+
<Route path="/admin/*" element={<AdminRouter />} />
21+
<Route index path="/main/*" element={<Main />} />
22+
<Route path="/" element={<Navigate to="/main" />} />
23+
</Routes>
24+
</Suspense>
2325
</Router>
2426
);
2527
}
2628

2729
const root = createRoot(document.getElementById('root'));
28-
root.render(<IndexApp />, );
30+
root.render(<IndexApp />);

package-lock.json

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "sails-react-bootstrap-webpack",
3-
"version": "3.0.0-beta.7",
3+
"version": "3.0.0",
44
"description": "An opinionated base configuration of Sails, with Webpack for React support, and Bootstrap for styling.",
55
"keywords": [
66
"sails",

0 commit comments

Comments
 (0)