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

🎨 リロードでエラー出すように #97

Merged
merged 2 commits into from
Dec 13, 2021
Merged

🎨 リロードでエラー出すように #97

merged 2 commits into from
Dec 13, 2021

Conversation

SSlime-s
Copy link
Member

fix #25

Router 並べてる場所にいい感じに書きたかったけどわかんなかった

Router 並べてる場所にいい感じに書きたかったけどわかんなかった
@SSlime-s SSlime-s requested a review from toshi-pono December 12, 2021 11:39
@SSlime-s SSlime-s self-assigned this Dec 12, 2021
Copy link
Member

@toshi-pono toshi-pono left a comment

Choose a reason for hiding this comment

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

:LGTM:

@SSlime-s SSlime-s merged commit 5a9fe92 into main Dec 13, 2021
@SSlime-s SSlime-s deleted the fix-misc branch December 13, 2021 03:43
@SSlime-s
Copy link
Member Author

え なんかマージしちゃった

@toshi-pono
Copy link
Member

これ,マージされたあとに気づいたけど,うまく機能してないかも

@SSlime-s
Copy link
Member Author

これまじ

@SSlime-s
Copy link
Member Author

ちなみに / では出してない

@toshi-pono
Copy link
Member

サイトを閉じるときは効いてるけど,トップページ→ロビー→お題,とかって進んだとき,戻るボタン押せちゃう(トップページに戻れる)

@toshi-pono
Copy link
Member

toshi-pono commented Dec 13, 2021

あと,App.tsxにこんなかんじで書けば,まとめて記述できるかも?もしくは,useMatch使っても良さそう
https://reach.tech/router/api/useMatch

const {pathname} = useLocation()
  useEffect(() => {
    if (pathname === '/') {
      removeBeforeUnload()
    } else {
      setBeforeUnload()
    }
  }, [pathname])

@SSlime-s
Copy link
Member Author

ソースどっか行っちゃったんだけど history 直接いじるみたいな処理には効かない的なのがあって、多分それだとおもう
解決策考える

サイトを閉じるときは効いてるけど,トップページ→ロビー→お題,とかって進んだとき,戻るボタン押せちゃう(トップページに戻れる)

@toshi-pono
Copy link
Member

:tasukaru:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants