mirror of
https://github.com/EnixCoda/Gitako.git
synced 2026-03-11 08:54:44 +00:00
refactor: use pjax:end for better compatibility
This commit is contained in:
parent
db0de416dc
commit
2c09a4308e
4 changed files with 6 additions and 6 deletions
|
|
@ -83,7 +83,7 @@ const RawGitako: React.FC<Props & ConnectorState> = function RawGitako(props) {
|
|||
},
|
||||
[props.metaData?.branchName, configContext.val.intelligentToggle],
|
||||
)
|
||||
useOnPJAXDone(updateSideBarVisibility, true)
|
||||
useOnPJAXDone(updateSideBarVisibility)
|
||||
|
||||
const copyFileButton = configContext.val.copyFileButton
|
||||
useGitHubAttachCopyFileButton(copyFileButton)
|
||||
|
|
|
|||
|
|
@ -293,7 +293,7 @@ export function useGitHubAttachCopySnippetButton(copySnippetButton: boolean) {
|
|||
[copySnippetButton],
|
||||
)
|
||||
React.useEffect(attachCopySnippetButton, [copySnippetButton])
|
||||
useOnPJAXDone(attachCopySnippetButton, true)
|
||||
useOnPJAXDone(attachCopySnippetButton)
|
||||
}
|
||||
|
||||
export function useGitHubAttachCopyFileButton(copyFileButton: boolean) {
|
||||
|
|
@ -305,5 +305,5 @@ export function useGitHubAttachCopyFileButton(copyFileButton: boolean) {
|
|||
[copyFileButton],
|
||||
)
|
||||
React.useEffect(attachCopyFileButton, [copyFileButton])
|
||||
useOnPJAXDone(attachCopyFileButton, true)
|
||||
useOnPJAXDone(attachCopyFileButton)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -173,5 +173,5 @@ export function useGiteeAttachCopySnippetButton(copySnippetButton: boolean) {
|
|||
[copySnippetButton],
|
||||
)
|
||||
React.useEffect(attachCopySnippetButton, [copySnippetButton])
|
||||
useOnPJAXDone(attachCopySnippetButton, true)
|
||||
useOnPJAXDone(attachCopySnippetButton)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -40,8 +40,8 @@ export const loadWithPJAX = (url: string) => {
|
|||
Pjax.assign(url, config)
|
||||
}
|
||||
|
||||
export function useOnPJAXDone(callback: () => void, legacy?: boolean) {
|
||||
useEvent(legacy ? 'pjax:end' : 'pjax:ready', callback, document)
|
||||
export function useOnPJAXDone(callback: () => void) {
|
||||
useEvent('pjax:end', callback, document)
|
||||
}
|
||||
|
||||
export function useRedirectedEvents(
|
||||
|
|
|
|||
Loading…
Reference in a new issue