@salesforcedevs/docs-components 1.3.300-fix-alpha1 → 1.3.300-fix-alpha2
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
|
@@ -1475,10 +1475,18 @@ export default class AmfReference extends LightningElement {
|
|
|
1475
1475
|
// update topic view
|
|
1476
1476
|
const { referenceId, amfId, type } = this.selectedTopic!;
|
|
1477
1477
|
|
|
1478
|
+
// Adding stringify inside try/catch
|
|
1479
|
+
let amfString = "";
|
|
1480
|
+
try {
|
|
1481
|
+
amfString = JSON.stringify(this.amfMap[referenceId].model);
|
|
1482
|
+
} catch (error) {
|
|
1483
|
+
console.error(`Error stringifying amf model: ${error}`);
|
|
1484
|
+
}
|
|
1485
|
+
|
|
1478
1486
|
// This updates the component in the content section.
|
|
1479
1487
|
this.topicModel = {
|
|
1480
1488
|
type,
|
|
1481
|
-
amf:
|
|
1489
|
+
amf: amfString,
|
|
1482
1490
|
parser: this.amfMap[referenceId].parser,
|
|
1483
1491
|
id: amfId
|
|
1484
1492
|
};
|
|
@@ -14,7 +14,7 @@ const TABLE_SIZE_MATCH = "769px";
|
|
|
14
14
|
|
|
15
15
|
export default class AmfTopic extends LightningElement {
|
|
16
16
|
private _model: TopicModel | undefined;
|
|
17
|
-
private amf: Json
|
|
17
|
+
private amf: Json;
|
|
18
18
|
private type: string | undefined;
|
|
19
19
|
|
|
20
20
|
@api
|
|
@@ -27,13 +27,17 @@ export default class AmfTopic extends LightningElement {
|
|
|
27
27
|
!this.amf ||
|
|
28
28
|
(value && this._model && value.amf !== this._model?.amf)
|
|
29
29
|
) {
|
|
30
|
-
|
|
30
|
+
try {
|
|
31
|
+
this.amf = value && JSON.parse(value.amf);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.error(`Error parsing amf model:: ${error}`);
|
|
34
|
+
}
|
|
31
35
|
}
|
|
32
36
|
if (
|
|
33
37
|
!this.type ||
|
|
34
38
|
(value && this._model && value.type !== this._model?.type)
|
|
35
39
|
) {
|
|
36
|
-
this.type = value && value.type;
|
|
40
|
+
this.type = value && clone(value.type);
|
|
37
41
|
}
|
|
38
42
|
|
|
39
43
|
this._model = value;
|
|
@@ -112,6 +116,6 @@ export default class AmfTopic extends LightningElement {
|
|
|
112
116
|
* @param value JSON Serializable object to clone.
|
|
113
117
|
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
|
|
114
118
|
*/
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
119
|
+
function clone(value: any): any {
|
|
120
|
+
return JSON.parse(JSON.stringify(value));
|
|
121
|
+
}
|