@@ -112,7 +112,25 @@ async function connect () {
112
112
113
113
// Components
114
114
115
- hook . on ( HookEvents . COMPONENT_UPDATED , throttle ( async ( app , uid , parentUid , component ) => {
115
+ const sendComponentUpdate = throttle ( async ( appRecord : AppRecord , id : string ) => {
116
+ try {
117
+ // Update component inspector
118
+ if ( id && isSubscribed ( BridgeSubscriptions . SELECTED_COMPONENT_DATA , sub => sub . payload . instanceId === id ) ) {
119
+ await sendSelectedComponentData ( appRecord , id , ctx )
120
+ }
121
+
122
+ // Update tree (tags)
123
+ if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === id ) ) {
124
+ await sendComponentTreeData ( appRecord , id , appRecord . componentFilter , 0 , ctx )
125
+ }
126
+ } catch ( e ) {
127
+ if ( SharedData . debugInfo ) {
128
+ console . error ( e )
129
+ }
130
+ }
131
+ } , 100 )
132
+
133
+ hook . on ( HookEvents . COMPONENT_UPDATED , async ( app , uid , parentUid , component ) => {
116
134
try {
117
135
if ( ! app || ! uid || ! component ) return
118
136
let id : string
@@ -125,29 +143,21 @@ async function connect () {
125
143
appRecord = ctx . currentAppRecord
126
144
}
127
145
128
- // Update component inspector
129
- if ( id && isSubscribed ( BridgeSubscriptions . SELECTED_COMPONENT_DATA , sub => sub . payload . instanceId === id ) ) {
130
- await sendSelectedComponentData ( appRecord , id , ctx )
131
- }
132
-
133
- // Update tree (tags)
134
- if ( isSubscribed ( BridgeSubscriptions . COMPONENT_TREE , sub => sub . payload . instanceId === id ) ) {
135
- await sendComponentTreeData ( appRecord , id , appRecord . componentFilter , 0 , ctx )
136
- }
137
-
138
146
if ( SharedData . trackUpdates ) {
139
147
await sendComponentUpdateTracking ( id , ctx )
140
148
}
141
149
142
150
if ( SharedData . flashUpdates ) {
143
151
await flashComponent ( component , appRecord . backend )
144
152
}
153
+
154
+ await sendComponentUpdate ( appRecord , id )
145
155
} catch ( e ) {
146
156
if ( SharedData . debugInfo ) {
147
157
console . error ( e )
148
158
}
149
159
}
150
- } , 1000 / 10 ) )
160
+ } )
151
161
152
162
hook . on ( HookEvents . COMPONENT_ADDED , async ( app , uid , parentUid , component ) => {
153
163
try {
0 commit comments