Skip to content

Commit

Permalink
fix(share): force full reload in `/s' routes
Browse files Browse the repository at this point in the history
  • Loading branch information
SnowSuno committed Nov 3, 2023
1 parent cc9db29 commit a63ecf5
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
2 changes: 2 additions & 0 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import { PrivateRoute, PublicRoute } from "hoc/AuthRoutes";
import pToP from "hoc/paramsToProps";

import AppWrapper from "./App.styled";
import Reload from "./components/pages/Reload";

const App = () => (
<AppWrapper>
Expand Down Expand Up @@ -55,6 +56,7 @@ const App = () => (
<PrivateRoute path="/settings" component={SettingsPage} />
<PublicRoute path="/auth" component={AuthPage} />
<Route path="/api" component={ApiPage} />
<Route path="/s" component={Reload} />
<Route path="/" exact component={LandingPage} />
<Route path="/main" exact component={HomePage} />
<Route path="/:name" component={ProfilePage} />
Expand Down
11 changes: 11 additions & 0 deletions src/components/pages/Reload.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
import React, { useEffect } from "react";

const Reload: React.FC = () => {
useEffect(() => {
location.reload();
}, []);

return <></>;
};

export default Reload;
1 change: 1 addition & 0 deletions src/components/pages/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,3 +26,4 @@ export const NotFound = loadable(/* webpackPrefetch: true */ () => import("./Not
// export const AdminPage = loadable(/* webpackPrefetch: true */ () => import("./AdminPage"));
export const SearchPage = loadable(/* webpackPrefetch: true */ () => import("./SearchPage"));
export const ApiPage = loadable(/* webpackPrefetch: true */ () => import("./ApiPage"));
export const ReloadPage = loadable(/* webpackPrefetch: true */ () => import("./Reload"));

0 comments on commit a63ecf5

Please sign in to comment.