Typing lessons like duolingo & musicmouse cleanup
This commit is contained in:
@@ -29,6 +29,11 @@ export function useHomeAssistant(config: HaConfig | null): HomeAssistant {
|
||||
// when the patch landed resolves with pre-click data - without this, that stale
|
||||
// response clobbers the optimistic "on" back to "off" until the *next* poll catches
|
||||
// up, which is what made toggling feel laggy despite the optimistic update existing.
|
||||
//
|
||||
// `usePlayerState`'s `optimistic()` solves the same "local guess vs. eventual truth"
|
||||
// problem far more simply, by just patching the whole object - it can get away with
|
||||
// that because the backend pushes over a websocket rather than being polled, so
|
||||
// there's no in-flight request that can resolve late and stomp on a newer patch.
|
||||
const optimisticAt = useRef<Record<string, number>>({});
|
||||
|
||||
const entityIds = useMemo(
|
||||
|
||||
Reference in New Issue
Block a user