File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change 11# @viamrobotics/svelte-sdk
22
3+ ## 0.7.2
4+
5+ ### Patch Changes
6+
7+ - 530af6c: do not create resource clients until connected
8+
39## 0.7.1
410
511### Patch Changes
Original file line number Diff line number Diff line change 22 "name" : " @viamrobotics/svelte-sdk" ,
33 "description" : " Build Svelte apps with Viam" ,
44 "license" : " Apache-2.0" ,
5- "version" : " 0.7.1 " ,
5+ "version" : " 0.7.2 " ,
66 "scripts" : {
77 "dev" : " vite dev" ,
88 "build" : " vite build && npm run prepack" ,
Original file line number Diff line number Diff line change 1- import type { Resource , RobotClient } from '@viamrobotics/sdk' ;
1+ import {
2+ type Resource ,
3+ type RobotClient ,
4+ MachineConnectionEvent ,
5+ } from '@viamrobotics/sdk' ;
26
3- import { useRobotClient } from './robot-clients.svelte' ;
7+ import { useConnectionStatus , useRobotClient } from './robot-clients.svelte' ;
48
59export type Client < T > = new ( part : RobotClient , name : string ) => T ;
610
@@ -10,12 +14,17 @@ export const createResourceClient = <T extends Resource>(
1014 resourceName : ( ) => string
1115) : { current : T | undefined } => {
1216 const robotClient = useRobotClient ( partID ) ;
17+ const connectionStatus = useConnectionStatus ( partID ) ;
1318
1419 const resourceClient = $derived . by < T | undefined > ( ( ) => {
1520 if ( ! robotClient . current ) {
1621 return ;
1722 }
1823
24+ if ( connectionStatus . current !== MachineConnectionEvent . CONNECTED ) {
25+ return ;
26+ }
27+
1928 const nextClient = new client ( robotClient . current , resourceName ( ) ) ;
2029
2130 // PartIDs are used to invalidate queries for this client
You can’t perform that action at this time.
0 commit comments