Skip to content

Commit

Permalink
Bugfix/UI: Fix widget lookup by id
Browse files Browse the repository at this point in the history
Fixes #424
  • Loading branch information
dsheeler authored and TheBizzle committed Aug 2, 2024
1 parent 1ff0975 commit edefa41
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions app/assets/javascripts/beak/widgets/widget-controller.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -96,9 +96,18 @@ class WidgetController
# (Number, Boolean, Array[Any]) => Unit
removeWidgetById: (id, wasNew, extraNotificationArgs) ->

widgetType = @ractive.get('widgetObj')[id].type
widgetType = null
widgetObj = @ractive.get('widgetObj')

for key, w of widgetObj
if w.id is id
widgetType = w.type
delete widgetObj[key]
break

if widgetType is null
throw new Error('Could not find widget to remove by id')

delete @ractive.get('widgetObj')[id]
@ractive.update('widgetObj')
@ractive.fire('deselect-widgets')

Expand Down

0 comments on commit edefa41

Please sign in to comment.