mirror of
https://github.com/supabase/supabase.git
synced 2026-05-06 17:00:27 -04:00
0674343912
* Fix(docs): prevent SecurityError from rapid history.replaceState calls during fast scrolling * url now chases the scroll * fixing merge conflicts * refactor: minor changes to safeHistoryReplaceState --------- Co-authored-by: Charis <26616127+charislam@users.noreply.github.com>
14 lines
345 B
TypeScript
14 lines
345 B
TypeScript
import { debounce } from 'lodash-es'
|
|
|
|
export const safeHistoryReplaceState = debounce((url: string) => {
|
|
if (typeof window === 'undefined') return
|
|
|
|
if (url === window.location.href) return
|
|
|
|
try {
|
|
window.history.replaceState(null, '', url)
|
|
} catch (error) {
|
|
console.warn('Failed to call history.replaceState:', error)
|
|
}
|
|
}, 120)
|