mirror of
https://github.com/docusealco/docuseal
synced 2026-11-04 06:42:32 -05:00
fix infinite scroll reload
This commit is contained in:
1 parent
05fa75f9a2
commit
ef28b80589
4 files changed
+15
-12
No files matched your search
@@ -69,8 +69,6 @@ import HistoryBack from './elements/history_back'
|
||||
import DatePlaceholder from './elements/date_placeholder'
|
||||
import FlashMessage from './elements/flash_message'
|
||||
|
||||
|
||||
|
||||
document.addEventListener('turbo:before-cache', () => {
|
||||
window.flash?.remove()
|
||||
})
|
||||
@@ -99,6 +97,16 @@ if (window.webkit?.messageHandlers?.native) {
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener('turbo:before-fetch-request', (event) => {
|
||||
const { session } = window.Turbo
|
||||
const visit = session.navigator.currentVisit
|
||||
const limit = document.getElementById('infinite_scroll')?.dataset.limit
|
||||
|
||||
if (limit && window.scrollY > 0 && event.target === document.documentElement && visit?.location.href === session.view.lastRenderedLocation.href && session.view.isPageRefresh(visit)) {
|
||||
event.detail.url.searchParams.set('limit', limit)
|
||||
}
|
||||
})
|
||||
|
||||
document.addEventListener('turbo:visit', (e) => {
|
||||
isRestoring = e.detail.action === 'restore'
|
||||
})
|
||||
|
||||
Reference in new issue
Block a user