Skip to content

fix: should not use window from render because of Node.js runtime #464

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

Merged
merged 1 commit into from
Dec 22, 2023
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
6 changes: 4 additions & 2 deletions src/pages/home/HomePage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import MainTemplate from '../../components/main/MainTemplate';
import Header from '../../components/base/Header';
import HomeTab from '../../components/home/HomeTab';
Expand All @@ -12,7 +12,9 @@ import FloatingHeader from '../../components/base/FloatingHeader';
export type HomePageProps = {};

function HomePage(props: HomePageProps) {
window.location.href = process.env.REACT_APP_CLIENT_V3_HOST!;
useEffect(() => {
window.location.href = process.env.REACT_APP_CLIENT_V3_HOST!;
}, []);
return (
<MainTemplate>
<Header />
Expand Down
8 changes: 5 additions & 3 deletions src/pages/velog/UserPage.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react';
import React, { useEffect } from 'react';
import styled from 'styled-components';
import VelogResponsive from '../../components/velog/VelogResponsive';
import UserProfileContainer from '../../containers/velog/UserProfileContainer';
Expand All @@ -18,8 +18,10 @@ export interface UserPageProps

const UserPage: React.FC<UserPageProps> = ({ match, location }) => {
const { username, tab } = match.params;
window.location.href = `${process.env
.REACT_APP_CLIENT_V3_HOST!}/@${username}/posts`;
useEffect(() => {
window.location.href = `${process.env
.REACT_APP_CLIENT_V3_HOST!}/@${username}/posts`;
}, []);

return (
<UserPageBlock>
Expand Down