@salesforcedevs/docs-components 1.3.300-async-fix-alpha4 → 1.3.300-fix-alpha
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
|
@@ -1478,7 +1478,7 @@ export default class AmfReference extends LightningElement {
|
|
|
1478
1478
|
// This updates the component in the content section.
|
|
1479
1479
|
this.topicModel = {
|
|
1480
1480
|
type,
|
|
1481
|
-
amf: this.amfMap[referenceId].model,
|
|
1481
|
+
amf: JSON.stringify(this.amfMap[referenceId].model),
|
|
1482
1482
|
parser: this.amfMap[referenceId].parser,
|
|
1483
1483
|
id: amfId
|
|
1484
1484
|
};
|
|
@@ -23,45 +23,24 @@ export default class AmfTopic extends LightningElement {
|
|
|
23
23
|
}
|
|
24
24
|
|
|
25
25
|
set model(value: TopicModel) {
|
|
26
|
-
|
|
26
|
+
if (
|
|
27
27
|
!this.amf ||
|
|
28
|
-
(value && this._model && value.amf !== this._model?.amf)
|
|
29
|
-
|
|
28
|
+
(value && this._model && value.amf !== this._model?.amf)
|
|
29
|
+
) {
|
|
30
|
+
this.amf = value && JSON.parse(value.amf);
|
|
31
|
+
}
|
|
32
|
+
if (
|
|
30
33
|
!this.type ||
|
|
31
|
-
(value && this._model && value.type !== this._model?.type)
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
typeNeedsClone ? value.type : this.type
|
|
36
|
-
)
|
|
37
|
-
.then(([clonedAmf, clonedType]) => {
|
|
38
|
-
this.amf = clonedAmf;
|
|
39
|
-
this.type = clonedType;
|
|
40
|
-
this._model = value;
|
|
41
|
-
this.update();
|
|
42
|
-
})
|
|
43
|
-
.catch((error) => {
|
|
44
|
-
console.error("Error cloning model:", error);
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
async cloneData(
|
|
49
|
-
amf: Json | undefined,
|
|
50
|
-
type: string | undefined
|
|
51
|
-
): Promise<[Json, string]> {
|
|
52
|
-
const clonedAmf = amf ? await this.clone(amf) : amf;
|
|
53
|
-
const clonedType = type ? await this.clone(type) : type;
|
|
54
|
-
return [clonedAmf, clonedType];
|
|
55
|
-
}
|
|
34
|
+
(value && this._model && value.type !== this._model?.type)
|
|
35
|
+
) {
|
|
36
|
+
this.type = value && value.type;
|
|
37
|
+
}
|
|
56
38
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
reject(error);
|
|
63
|
-
}
|
|
64
|
-
});
|
|
39
|
+
this._model = value;
|
|
40
|
+
if (this._model) {
|
|
41
|
+
this.update();
|
|
42
|
+
}
|
|
43
|
+
// else { Remove child? No model, seems like no component should be shown. }
|
|
65
44
|
}
|
|
66
45
|
|
|
67
46
|
update(): void {
|
|
@@ -112,18 +91,27 @@ export default class AmfTopic extends LightningElement {
|
|
|
112
91
|
const isTabletOrDesktop = window.matchMedia(
|
|
113
92
|
`(min-width: ${TABLE_SIZE_MATCH})`
|
|
114
93
|
).matches;
|
|
94
|
+
|
|
115
95
|
if (isTabletOrDesktop) {
|
|
116
96
|
window.scrollTo(0, 0);
|
|
117
97
|
}
|
|
118
98
|
}
|
|
119
99
|
|
|
120
100
|
renderedCallback(): void {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
console.error(error);
|
|
126
|
-
}
|
|
101
|
+
try {
|
|
102
|
+
this.update();
|
|
103
|
+
} catch (error) {
|
|
104
|
+
console.error(error);
|
|
127
105
|
}
|
|
128
106
|
}
|
|
129
107
|
}
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The underlying web components we use from api-console mutate their models we pass in.
|
|
111
|
+
* Since LWC makes them Read Only, we need to copy them before passing to the Web Component.
|
|
112
|
+
* @param value JSON Serializable object to clone.
|
|
113
|
+
* @returns A copy of Value. One that has been serialized and parsed via JSON. (Functions, Regex, etc are not preserved.)
|
|
114
|
+
*/
|
|
115
|
+
// function clone(value: any): any {
|
|
116
|
+
// return JSON.parse(JSON.stringify(value));
|
|
117
|
+
// }
|