Skip to content

Commit e25468c

Browse files
committed
fix(components): add guards, closes #1792
1 parent 6045538 commit e25468c

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -114,6 +114,7 @@ async function connect () {
114114

115115
hook.on(HookEvents.COMPONENT_UPDATED, throttle(async (app, uid, parentUid, component) => {
116116
try {
117+
if (!app || !uid || !component) return
117118
let id: string
118119
let appRecord: AppRecord
119120
if (app && uid != null) {
@@ -150,6 +151,7 @@ async function connect () {
150151

151152
hook.on(HookEvents.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
152153
try {
154+
if (!app || !uid || !component) return
153155
const id = await getComponentId(app, uid, component, ctx)
154156
const appRecord = await getAppRecord(app, ctx)
155157
if (component) {
@@ -202,6 +204,7 @@ async function connect () {
202204

203205
hook.on(HookEvents.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
204206
try {
207+
if (!app || !uid || !component) return
205208
const appRecord = await getAppRecord(app, ctx)
206209
if (parentUid != null) {
207210
const parentInstances = await appRecord.backend.api.walkComponentParents(component)

0 commit comments

Comments
 (0)