@buerokratt-ria/menu 0.1.12 → 0.1.13

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/CHANGELOG.md CHANGED
@@ -2,6 +2,10 @@
2
2
 
3
3
  All changes to this project will be documented in this file.
4
4
 
5
+ ## [0.1.13] - 07-06-2024
6
+
7
+ - Fix a bug
8
+
5
9
  ## [0.1.12] - 07-06-2024
6
10
 
7
11
  - Add dynamic hidden menu items
Binary file
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@buerokratt-ria/menu",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "Generic MainNavigation component that would be injected as dependency.",
5
5
  "main": "index.js",
6
6
  "scripts": {},
@@ -30,7 +30,18 @@ const useMenuItems = () => {
30
30
  });
31
31
 
32
32
  const items = useMemo(() => {
33
- const allItems = externalMenuItems ?? mainMenuItems ?? menuStructure ?? [];
33
+ let externals;
34
+
35
+ try {
36
+ externals = JSON.parse(externalMenuItems);
37
+ if(!externals.isArray) {
38
+ console.error('REACT_APP_MENU_JSON was ignored becuase it wasn\'t an array');
39
+ }
40
+ } catch (e) {
41
+ console.error(e);
42
+ }
43
+
44
+ const allItems = externals ?? mainMenuItems ?? menuStructure ?? [];
34
45
  return allItems.filter(x => !x.hidden);
35
46
  }, [externalMenuItems, mainMenuItems, menuStructure]);
36
47
 
Binary file