Skip to content

Commit

Permalink
tsc
Browse files Browse the repository at this point in the history
  • Loading branch information
brentyi committed Sep 24, 2024
1 parent b271c08 commit abaa97d
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/viser/_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,7 +1137,7 @@ class GuiUpdateMessage(Message):
id: str
updates: Annotated[
Dict[str, Any],
infra.TypeScriptAnnotationOverride("Partial<GuiComponentMessage>"),
infra.TypeScriptAnnotationOverride("{[key: string]: any}"),
]
"""Mapping from property name to new value."""

Expand Down
7 changes: 5 additions & 2 deletions src/viser/client/src/ControlPanel/GuiState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,14 +164,17 @@ export function useGuiState(initialServer: string) {

// Iterate over key/value pairs.
for (const [key, value] of Object.entries(updates)) {
// We don't put `value` in the props object to make types
// stronger in the user-facing Python API. This results in some
// nastiness here, we should revisit...
if (key === "value") {
state.guiConfigFromId[id].value = value;
(state.guiConfigFromId[id] as any).value = value;
} else if (!(key in config.props)) {
console.error(
`Tried to update nonexistent property '${key}' of GUI element ${id}!`,
);
} else {
state.guiConfigFromId[id].props[key] = value;
(state.guiConfigFromId[id].props as any)[key] = value;
}
}
});
Expand Down
2 changes: 1 addition & 1 deletion src/viser/client/src/WebsocketMessages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -946,7 +946,7 @@ export interface GuiRemoveMessage {
export interface GuiUpdateMessage {
type: "GuiUpdateMessage";
id: string;
updates: Partial<GuiComponentMessage>;
updates: { [key: string]: any };
}
/** Sent client<->server when any property of a scene node is changed.
*
Expand Down
5 changes: 1 addition & 4 deletions src/viser/client/src/components/ProgressBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,7 @@ import { Box, Progress } from "@mantine/core";
import { GuiProgressBarMessage } from "../WebsocketMessages";

export default function ProgressBarComponent({
visible,
color,
value,
animated,
props: { visible, color, value, animated },
}: GuiProgressBarMessage) {
if (!visible) return <></>;
return (
Expand Down

0 comments on commit abaa97d

Please sign in to comment.