@salesforcedevs/docs-components 1.34.5-bug-fix-alpha → 1.34.5-bug-fix-alpha1
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
|
@@ -17,6 +17,7 @@ import {
|
|
|
17
17
|
DOCS_PATH_SEGMENT,
|
|
18
18
|
normalizePath,
|
|
19
19
|
getTopicVersionKey,
|
|
20
|
+
getVersionPickerOptions,
|
|
20
21
|
persistTopicVersion,
|
|
21
22
|
REFERENCES_LOCALE_SEGMENT_INDEX,
|
|
22
23
|
toCanonicalHref
|
|
@@ -106,6 +107,7 @@ export default class RedocReference extends LightningElement {
|
|
|
106
107
|
error
|
|
107
108
|
);
|
|
108
109
|
}
|
|
110
|
+
this.refreshVersions();
|
|
109
111
|
}
|
|
110
112
|
|
|
111
113
|
@api
|
|
@@ -155,6 +157,7 @@ export default class RedocReference extends LightningElement {
|
|
|
155
157
|
} catch (error) {
|
|
156
158
|
this._parentTopicFamilyNode = null;
|
|
157
159
|
}
|
|
160
|
+
this.refreshVersions();
|
|
158
161
|
}
|
|
159
162
|
|
|
160
163
|
get parentTopicFamily(): { topics?: VersionedNode[] } | null {
|
|
@@ -201,8 +204,44 @@ export default class RedocReference extends LightningElement {
|
|
|
201
204
|
return refCount > 1;
|
|
202
205
|
}
|
|
203
206
|
|
|
207
|
+
private _versions: ReferenceVersion[] = [];
|
|
208
|
+
|
|
204
209
|
get versions(): ReferenceVersion[] {
|
|
205
|
-
return this.
|
|
210
|
+
return this._versions;
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
/**
|
|
214
|
+
* Picker hrefs for the open page. Both setters call this because LWC can
|
|
215
|
+
* assign referenceConfig and parentTopicFamily in either order. The page
|
|
216
|
+
* URL is already set by then and does not change for this instance.
|
|
217
|
+
*/
|
|
218
|
+
private refreshVersions(): void {
|
|
219
|
+
const versions = this._referenceConfig?.versions ?? [];
|
|
220
|
+
const node = this._parentTopicFamilyNode;
|
|
221
|
+
if (!node?.versions?.length || typeof window === "undefined") {
|
|
222
|
+
this._versions = versions;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
// Same helper as the markdown sidebar. The same array means this page
|
|
227
|
+
// is outside the topic, so the backend switching URLs stay as authored.
|
|
228
|
+
const rewritten = getVersionPickerOptions(node);
|
|
229
|
+
if (!rewritten || rewritten === node.versions) {
|
|
230
|
+
this._versions = versions;
|
|
231
|
+
return;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
this._versions = versions.map((version) => {
|
|
235
|
+
const href = rewritten.find((option) => option.id === version.id)
|
|
236
|
+
?.link?.href;
|
|
237
|
+
if (!href || href === version.link?.href) {
|
|
238
|
+
return version;
|
|
239
|
+
}
|
|
240
|
+
return {
|
|
241
|
+
...version,
|
|
242
|
+
link: { ...version.link, href }
|
|
243
|
+
};
|
|
244
|
+
});
|
|
206
245
|
}
|
|
207
246
|
|
|
208
247
|
/** The version flagged `selected`, else the first (the latest/GA version). */
|