@soleil-se/app-util 4.0.0 → 4.0.1

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
@@ -4,6 +4,10 @@ All notable changes to this project will be documented in this file.
4
4
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
5
5
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
6
6
 
7
+ ## [4.0.1] - 2021-01-28
8
+ ### Fixed
9
+ - Crashes when no data is passed to app and then trying to call `getAppData`.
10
+
7
11
  ## [4.0.0] - 2021-01-27
8
12
  A much needed major overhaul of the package.
9
13
  See [MIGRATION](./MIGRATION.md).
package/common/index.js CHANGED
@@ -124,7 +124,7 @@ export function getAppMetadata() {
124
124
  };
125
125
  }
126
126
 
127
- let appData = process.browser ? parseAttribute('data-app-data') : {};
127
+ let appData = process.browser ? parseAttribute('data-app-data') : undefined;
128
128
 
129
129
  export function setAppData(data) {
130
130
  appData = data;
@@ -137,8 +137,8 @@ export function setAppData(data) {
137
137
  * @return {*|Object} - Value or object.
138
138
  */
139
139
  export function getAppData(key) {
140
- if (process.browser && !Object.keys(appData).length) {
141
- setAppData(parseAttribute('data-options'));
140
+ if (process.browser && !appData) {
141
+ setAppData(parseAttribute('data-app-data'));
142
142
  }
143
143
  return key ? appData[key] : appData;
144
144
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@soleil-se/app-util",
3
- "version": "4.0.0",
3
+ "version": "4.0.1",
4
4
  "description": "Utility functions for Webapps.",
5
5
  "main": "./common/index.js",
6
6
  "author": "Soleil AB",
@@ -14,7 +14,7 @@
14
14
  "optionalDependencies": {
15
15
  "vue": "^2.6.11"
16
16
  },
17
- "gitHead": "a59289650f6f1c5277566106c29fb8db01fbebd1",
17
+ "gitHead": "dd52fb7647d05798b523bf3f347e90118db7c4c7",
18
18
  "dependencies": {},
19
19
  "devDependencies": {}
20
20
  }
package/server/index.js CHANGED
@@ -28,7 +28,7 @@ const isIE = (req) => {
28
28
  * specific script loading if you have multiple instances of the app.
29
29
  * @returns {String} HTML for rendering an application.
30
30
  */
31
- export function render(data, {
31
+ export function render(data = {}, {
32
32
  html = '',
33
33
  selector = `[data-portlet-id="${appId}"]`,
34
34
  async = false,