• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mobalazs / rotor-framework / 18919729013

29 Oct 2025 07:21PM UTC coverage: 85.379% (-0.1%) from 85.479%
18919729013

push

github

mobalazs
fix: update debug setting in bsconfig to enable debugging

1781 of 2086 relevant lines covered (85.38%)

1.16 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

75.0
/src/source/engine/builder/WidgetUpdate.bs
1
namespace Rotor.ViewBuilder
2

3
    ' =====================================================================
4
    ' updateWidget - Updates an existing widget with new configuration. Handles props updates, viewModelState changes, plugin lifecycle hooks, z-index changes, and custom lifecycle callbacks.
5
    '
6
    ' @param {object} postProcessBuffer - Buffer for deferred plugin/lifecycle operations
7
    ' @param {object} widget - Existing widget instance to update
8
    ' @param {object} newConfig - New configuration to apply
9
    ' @returns {object} Object with children and HID for further processing
10
    ' =====================================================================
11
    function updateWidget(postProcessBuffer as object, widget as object, newConfig as object) as object
12
        HID = widget.HID
1✔
13

14
        isWidgetChanged = false
1✔
15

16
        if widget?.isViewModel = true and newConfig.DoesExist("props")
2✔
17
            newConfig.delete("viewModel") ' In case app update with the same template.
1✔
18
            postProcessBuffer.add({
1✔
19
                hookType: Rotor.Const.LifeCycleHookType.VIEWMODEL_STATE_UPDATE,
20
                widget: widget,
21
                props: newConfig.props
22
            })
23
        end if
24

25
        if newConfig.DoesExist("viewModelState")
2✔
26
            Rotor.Utils.deepExtendAA(widget.viewModelState, newConfig.viewModelState)
×
27
            isWidgetChanged = true
×
28
        end if
29

30
        ' Method decorators during update
31

32
        pluginKeyList = m.frameworkInstance.builder.pluginAdapter.pluginKeyList
1✔
33
        pluginKeyList.ResetIndex()
1✔
34
        pluginKey = pluginKeyList.GetIndex()
1✔
35
        while pluginKey <> invalid
1✔
36

37
            if newConfig.doesExist(pluginKey)
2✔
38
                for each LifeCycleHookType in [Rotor.Const.LifeCycleHookType.BEFORE_UPDATE, Rotor.Const.LifeCycleHookType.AFTER_UPDATED]
1✔
39
                    if m.frameworkInstance.builder.pluginAdapter.pluginHooks[LifeCycleHookType].DoesExist(pluginKey)
2✔
40

41
                        isWidgetChanged = true
1✔
42

43
                        process = {
1✔
44
                            isPlugin: true,
45
                            widget: widget,
46
                            hookType: LifeCycleHookType,
47
                            ' isView: widget?.isView ?? false,
48
                            pluginKey: pluginKey
49
                        }
50

51
                        if LifeCycleHookType = Rotor.Const.LifeCycleHookType.BEFORE_UPDATE or LifeCycleHookType = Rotor.Const.LifeCycleHookType.AFTER_UPDATED
3✔
52
                            newValue = newConfig[pluginKey]
1✔
53
                            oldValue = widget[pluginKey]
1✔
54
                            ' Change is depend on plugin ;)
55
                            process.append({
1✔
56
                                oldValue: oldValue,
57
                                newValue: newValue
58
                            })
59
                        end if
60

61
                        postProcessBuffer.add(process)
1✔
62

63
                    end if
64
                end for
65
            end if
66

67
            pluginKey = pluginKeyList.GetIndex()
1✔
68
        end while
69

70

71
        if Rotor.Utils.isInteger(newConfig.zIndex)
2✔
72
            postProcessBuffer.add({
×
73
                hookType: Rotor.Const.LifeCycleHookType.REINDEX_CHILD,
74
                widget: widget,
75
                zIndex: newConfig.zIndex
76
            })
77
        end if
78

79

80
        if Rotor.Utils.isFunction(newConfig.onUpdateWidget)
2✔
81
            isWidgetChanged = true
×
82
            widget.onUpdateWidget = newConfig.onUpdateWidget
×
83
        end if
84

85
        if Rotor.Utils.isFunction(newConfig.onDestroyWidget)
2✔
86
            widget.onDestroyWidget = newConfig.onDestroyWidget
×
87
        end if
88

89
        if Rotor.Utils.isFunction(newConfig.onRenderSettled) = true
2✔
90
            m.frameworkInstance.builder.callbackQueue.push({
×
91
                callback: newConfig.onRenderSettled,
92
                callbackScope: widget
93
            })
94
            newConfig.delete("onRenderSettled")
×
95
        end if
96

97

98
        if isWidgetChanged = true and Rotor.Utils.isFunction(widget.onUpdateWidget)
2✔
99
            postProcessBuffer.add({
×
100
                hookType: Rotor.Const.LifeCycleHookType.UPDATED,
101
                widget: widget
102
            })
103
        end if
104

105
        return {
1✔
106
            children: newConfig.children,
107
            HID: HID
108
        }
109

110
    end function
111

112

113
end namespace
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc