robobyte-front-builder 1.0.5 → 1.0.6
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -18,15 +18,20 @@ export default function ComponentsTab() {
|
|
|
18
18
|
isDataOnly: true,
|
|
19
19
|
isPagination: false
|
|
20
20
|
})
|
|
21
|
-
if (response) setWidgets(response)
|
|
21
|
+
if (Array.isArray(response)) setWidgets(response)
|
|
22
22
|
} catch (error) {
|
|
23
23
|
console.error(error)
|
|
24
24
|
}
|
|
25
25
|
}
|
|
26
26
|
|
|
27
27
|
const sections = useMemo(() => {
|
|
28
|
-
// 1) Group widgets
|
|
29
|
-
const
|
|
28
|
+
// 1) Group widgets (manual groupBy — Object.groupBy requires Chrome 117+ / Node 21+)
|
|
29
|
+
const safeWidgets = Array.isArray(widgets) ? widgets : []
|
|
30
|
+
const grouped = safeWidgets.reduce((acc, x) => {
|
|
31
|
+
const key = x.widgetCategory?.name ?? 'Widgets'
|
|
32
|
+
;(acc[key] ??= []).push(x)
|
|
33
|
+
return acc
|
|
34
|
+
}, {})
|
|
30
35
|
// 2) Convert grouped → sections
|
|
31
36
|
const newSections = Object.entries(grouped).map(([key, items]) => ({
|
|
32
37
|
key,
|