広場投稿追加画面の刷新 (#399) #413

マージ済み
みてるぞ が 103 個のコミットを feature/399 から main へマージ 2026-07-19 00:03:11 +09:00
コミット 23d8adf65d の変更だけを表示してゐます - すべてのコミットを表示
+1 -26
ファイルの表示
@@ -7,7 +7,7 @@ import {
useRef, useRef,
useState, useState,
} from 'react' } from 'react'
import { useBlocker, useLocation } from 'react-router-dom' import { useLocation } from 'react-router-dom'
import { useDialogue } from '@/lib/dialogues/useDialogue' import { useDialogue } from '@/lib/dialogues/useDialogue'
@@ -65,31 +65,6 @@ export const UnsavedChangesGuardProvider: FC<PropsWithChildren> = ({ children })
return true return true
}, [dialogue, source]) }, [dialogue, source])
const blocker = useBlocker (() =>
source?.dirty === true && !(bypassNextNavigationRef.current))
useEffect (() => {
if (blocker.state !== 'blocked')
return
let cancelled = false
void (async () => {
const confirmed = await confirmDiscardNavigation ()
if (cancelled)
return
if (confirmed)
blocker.proceed ()
else
blocker.reset ()
}) ()
return () => {
cancelled = true
}
}, [blocker, confirmDiscardNavigation])
useEffect (() => { useEffect (() => {
bypassNextNavigationRef.current = false bypassNextNavigationRef.current = false
}, [location.hash, location.pathname, location.search]) }, [location.hash, location.pathname, location.search])