mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
fix: disallow expand on error
This commit is contained in:
parent
4982b9a1ca
commit
a1853ec3d2
1 changed files with 6 additions and 3 deletions
|
|
@ -278,18 +278,21 @@ function useCollapseOnNoPermissionWhenTokenHasBeenSet(
|
|||
|
||||
function useShouldExpand() {
|
||||
const getDerivedExpansion = useGetDerivedExpansion()
|
||||
const error = useLoadedContext(SideBarErrorContext).value
|
||||
const [shouldExpand, setShouldExpand] = React.useState(getDerivedExpansion)
|
||||
const toggleShowSideBar = React.useCallback(
|
||||
() => setShouldExpand(show => !show),
|
||||
[setShouldExpand],
|
||||
)
|
||||
|
||||
useSaveExpandStateOnToggle(shouldExpand)
|
||||
useUpdateBodyIndentOnStateUpdate(shouldExpand)
|
||||
const $shouldExpand = error ? false : shouldExpand
|
||||
|
||||
useSaveExpandStateOnToggle($shouldExpand)
|
||||
useUpdateBodyIndentOnStateUpdate($shouldExpand)
|
||||
useUpdateBodyIndentAfterRedirect(setShouldExpand)
|
||||
useCollapseOnNoPermissionWhenTokenHasBeenSet(setShouldExpand)
|
||||
|
||||
return [shouldExpand, setShouldExpand, toggleShowSideBar] as const
|
||||
return [$shouldExpand, setShouldExpand, toggleShowSideBar] as const
|
||||
}
|
||||
|
||||
function useShowSidebarKeyboard(
|
||||
|
|
|
|||
Loading…
Reference in a new issue