@camstack/ui-library 1.2.6 → 1.2.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +7 -9
- package/dist/index.js +7 -9
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -45052,29 +45052,26 @@ function StateValuesStream({ deviceId, defaultCaps, maxHeight = "max-h-96", onCl
|
|
|
45052
45052
|
}
|
|
45053
45053
|
}, [deviceId]);
|
|
45054
45054
|
const { data: snapshot, isLoading } = trpc.deviceState.getAllSnapshots.useQuery({}, { staleTime: 3e4 });
|
|
45055
|
-
const seededRef = (0, react$1.useRef)(false);
|
|
45056
45055
|
(0, react$1.useEffect)(() => {
|
|
45057
|
-
if (seededRef.current) return;
|
|
45058
45056
|
if (!isSystemSnapshot(snapshot)) return;
|
|
45059
45057
|
const deviceSlices = snapshot[String(deviceId)];
|
|
45060
|
-
seededRef.current = true;
|
|
45061
45058
|
if (!deviceSlices) return;
|
|
45062
45059
|
const now = Date.now();
|
|
45063
45060
|
setCapStates((prev) => {
|
|
45061
|
+
let mutated = false;
|
|
45064
45062
|
const next = new Map(prev);
|
|
45065
45063
|
for (const [capName, slice] of Object.entries(deviceSlices)) {
|
|
45066
|
-
|
|
45064
|
+
const existing = next.get(capName);
|
|
45065
|
+
if (existing && existing.placeholder !== true) continue;
|
|
45067
45066
|
next.set(capName, {
|
|
45068
45067
|
slice,
|
|
45069
45068
|
updatedAt: now
|
|
45070
45069
|
});
|
|
45070
|
+
mutated = true;
|
|
45071
45071
|
}
|
|
45072
|
-
return next;
|
|
45072
|
+
return mutated ? next : prev;
|
|
45073
45073
|
});
|
|
45074
45074
|
}, [snapshot, deviceId]);
|
|
45075
|
-
(0, react$1.useEffect)(() => {
|
|
45076
|
-
seededRef.current = false;
|
|
45077
|
-
}, [deviceId]);
|
|
45078
45075
|
const { data: bindings } = trpc.deviceManager.getBindings.useQuery({ deviceId }, { staleTime: 3e4 });
|
|
45079
45076
|
(0, react$1.useEffect)(() => {
|
|
45080
45077
|
const entries = bindings?.entries;
|
|
@@ -45089,7 +45086,8 @@ function StateValuesStream({ deviceId, defaultCaps, maxHeight = "max-h-96", onCl
|
|
|
45089
45086
|
if (!slice) continue;
|
|
45090
45087
|
next.set(entry.capName, {
|
|
45091
45088
|
slice,
|
|
45092
|
-
updatedAt: now
|
|
45089
|
+
updatedAt: now,
|
|
45090
|
+
placeholder: true
|
|
45093
45091
|
});
|
|
45094
45092
|
mutated = true;
|
|
45095
45093
|
}
|
package/dist/index.js
CHANGED
|
@@ -45028,29 +45028,26 @@ function StateValuesStream({ deviceId, defaultCaps, maxHeight = "max-h-96", onCl
|
|
|
45028
45028
|
}
|
|
45029
45029
|
}, [deviceId]);
|
|
45030
45030
|
const { data: snapshot, isLoading } = trpc.deviceState.getAllSnapshots.useQuery({}, { staleTime: 3e4 });
|
|
45031
|
-
const seededRef = useRef(false);
|
|
45032
45031
|
useEffect(() => {
|
|
45033
|
-
if (seededRef.current) return;
|
|
45034
45032
|
if (!isSystemSnapshot(snapshot)) return;
|
|
45035
45033
|
const deviceSlices = snapshot[String(deviceId)];
|
|
45036
|
-
seededRef.current = true;
|
|
45037
45034
|
if (!deviceSlices) return;
|
|
45038
45035
|
const now = Date.now();
|
|
45039
45036
|
setCapStates((prev) => {
|
|
45037
|
+
let mutated = false;
|
|
45040
45038
|
const next = new Map(prev);
|
|
45041
45039
|
for (const [capName, slice] of Object.entries(deviceSlices)) {
|
|
45042
|
-
|
|
45040
|
+
const existing = next.get(capName);
|
|
45041
|
+
if (existing && existing.placeholder !== true) continue;
|
|
45043
45042
|
next.set(capName, {
|
|
45044
45043
|
slice,
|
|
45045
45044
|
updatedAt: now
|
|
45046
45045
|
});
|
|
45046
|
+
mutated = true;
|
|
45047
45047
|
}
|
|
45048
|
-
return next;
|
|
45048
|
+
return mutated ? next : prev;
|
|
45049
45049
|
});
|
|
45050
45050
|
}, [snapshot, deviceId]);
|
|
45051
|
-
useEffect(() => {
|
|
45052
|
-
seededRef.current = false;
|
|
45053
|
-
}, [deviceId]);
|
|
45054
45051
|
const { data: bindings } = trpc.deviceManager.getBindings.useQuery({ deviceId }, { staleTime: 3e4 });
|
|
45055
45052
|
useEffect(() => {
|
|
45056
45053
|
const entries = bindings?.entries;
|
|
@@ -45065,7 +45062,8 @@ function StateValuesStream({ deviceId, defaultCaps, maxHeight = "max-h-96", onCl
|
|
|
45065
45062
|
if (!slice) continue;
|
|
45066
45063
|
next.set(entry.capName, {
|
|
45067
45064
|
slice,
|
|
45068
|
-
updatedAt: now
|
|
45065
|
+
updatedAt: now,
|
|
45066
|
+
placeholder: true
|
|
45069
45067
|
});
|
|
45070
45068
|
mutated = true;
|
|
45071
45069
|
}
|