Skip to content

Commit

Permalink
fix(components): add guards, closes #1792
Browse files Browse the repository at this point in the history
  • Loading branch information
Akryum committed Mar 14, 2022
1 parent 6045538 commit e25468c
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/app-backend-core/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ async function connect () {

hook.on(HookEvents.COMPONENT_UPDATED, throttle(async (app, uid, parentUid, component) => {
try {
if (!app || !uid || !component) return
let id: string
let appRecord: AppRecord
if (app && uid != null) {
Expand Down Expand Up @@ -150,6 +151,7 @@ async function connect () {

hook.on(HookEvents.COMPONENT_ADDED, async (app, uid, parentUid, component) => {
try {
if (!app || !uid || !component) return
const id = await getComponentId(app, uid, component, ctx)
const appRecord = await getAppRecord(app, ctx)
if (component) {
Expand Down Expand Up @@ -202,6 +204,7 @@ async function connect () {

hook.on(HookEvents.COMPONENT_REMOVED, async (app, uid, parentUid, component) => {
try {
if (!app || !uid || !component) return
const appRecord = await getAppRecord(app, ctx)
if (parentUid != null) {
const parentInstances = await appRecord.backend.api.walkComponentParents(component)
Expand Down

0 comments on commit e25468c

Please sign in to comment.