Skip to content

Commit 4c9e6fa

Browse files
authored
fix: state not updating for root component (#1895)
1 parent 2d4a5e3 commit 4c9e6fa

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

packages/app-backend-core/src/index.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ async function connect () {
136136

137137
hook.on(HookEvents.COMPONENT_UPDATED, async (app, uid, parentUid, component) => {
138138
try {
139-
if (!app || !uid || !component) return
139+
if (!app || (typeof uid !== 'number' && !uid) || !component) return
140140
let id: string
141141
let appRecord: AppRecord
142142
if (app && uid != null) {
@@ -165,7 +165,7 @@ async function connect () {
165165

166166
hook.on(HookEvents.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
167167
try {
168-
if (!app || !uid || !component) return
168+
if (!app || (typeof uid !== 'number' && !uid) || !component) return
169169
const id = await getComponentId(app, uid, component, ctx)
170170
const appRecord = await getAppRecord(app, ctx)
171171
if (component) {
@@ -218,7 +218,7 @@ async function connect () {
218218

219219
hook.on(HookEvents.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
220220
try {
221-
if (!app || !uid || !component) return
221+
if (!app || (typeof uid !== 'number' && !uid) || !component) return
222222
const appRecord = await getAppRecord(app, ctx)
223223
if (parentUid != null) {
224224
const parentInstances = await appRecord.backend.api.walkComponentParents(component)

0 commit comments

Comments
 (0)