mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-24 09:46:36 +00:00
Throttle replace state in restore scroll (#16693)
This commit is contained in:
parent
9b896c63b6
commit
2219c9bbd3
@ -1,5 +1,10 @@
|
||||
import type { LitElement } from "lit";
|
||||
import type { ClassElement } from "../../types";
|
||||
import { throttle } from "../util/throttle";
|
||||
|
||||
const throttleReplaceState = throttle((value) => {
|
||||
history.replaceState({ scrollPosition: value }, "");
|
||||
}, 300);
|
||||
|
||||
export const restoreScroll =
|
||||
(selector: string): any =>
|
||||
@ -9,7 +14,7 @@ export const restoreScroll =
|
||||
key: element.key,
|
||||
descriptor: {
|
||||
set(this: LitElement, value: number) {
|
||||
history.replaceState({ scrollPosition: value }, "");
|
||||
throttleReplaceState(value);
|
||||
this[`__${String(element.key)}`] = value;
|
||||
},
|
||||
get(this: LitElement) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user