-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #9011 from weseek/fix/autofocus-to-page-header
fix: Wrongly autofocus to PageHeader even after updating
- Loading branch information
Showing
6 changed files
with
41 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,2 @@ | ||
import { apiv3Put } from '~/client/util/apiv3-client'; | ||
import type { IApiv3PageUpdateParams, IApiv3PageUpdateResponse } from '~/interfaces/apiv3'; | ||
|
||
export * from './conflict'; | ||
|
||
export const updatePage = async(params: IApiv3PageUpdateParams): Promise<IApiv3PageUpdateResponse> => { | ||
const res = await apiv3Put<IApiv3PageUpdateResponse>('/page', params); | ||
return res.data; | ||
}; | ||
export * from './use-update-page'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
import { apiv3Put } from '~/client/util/apiv3-client'; | ||
import type { IApiv3PageUpdateParams, IApiv3PageUpdateResponse } from '~/interfaces/apiv3'; | ||
|
||
export const updatePage = async(params: IApiv3PageUpdateParams): Promise<IApiv3PageUpdateResponse> => { | ||
const res = await apiv3Put<IApiv3PageUpdateResponse>('/page', params); | ||
return res.data; | ||
}; |
25 changes: 25 additions & 0 deletions
25
apps/app/src/client/services/update-page/use-update-page.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import { useCallback } from 'react'; | ||
|
||
import type { IApiv3PageUpdateParams, IApiv3PageUpdateResponse } from '~/interfaces/apiv3'; | ||
import { useIsUntitledPage } from '~/stores/ui'; | ||
|
||
import { updatePage } from './update-page'; | ||
|
||
|
||
type UseUpdatePage = (params: IApiv3PageUpdateParams) => Promise<IApiv3PageUpdateResponse>; | ||
|
||
|
||
export const useUpdatePage = (): UseUpdatePage => { | ||
const { mutate: mutateUntitledPage } = useIsUntitledPage(); | ||
|
||
const updatePageExt: UseUpdatePage = useCallback(async(params) => { | ||
const result = await updatePage(params); | ||
|
||
// set false to isUntitledPage | ||
mutateUntitledPage(false); | ||
|
||
return result; | ||
}, [mutateUntitledPage]); | ||
|
||
return updatePageExt; | ||
}; |