@salesforcedevs/dx-components 1.40.5-final-alpha → 1.40.5-final-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
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@salesforcedevs/dx-components",
3
- "version": "1.40.5-final-alpha",
3
+ "version": "1.40.5-final-alpha1",
4
4
  "description": "DX Lightning web components",
5
5
  "license": "MIT",
6
6
  "engines": {
@@ -294,13 +294,13 @@ export function toCanonicalHref(
294
294
  }
295
295
 
296
296
  for (const version of versions) {
297
- if (version.id === versions[0].id) {
298
- continue;
299
- }
300
- const delta = getVersionPathDelta(
301
- latestPath,
302
- normalizePath(version.link?.href)
303
- );
297
+ // The latest is also served under `/<latestId>/`, so that form is
298
+ // stripped too.
299
+ const versionedPath =
300
+ version.id === versions[0].id
301
+ ? insertVersionBeforeSlug(latestPath, version.id)
302
+ : normalizePath(version.link?.href);
303
+ const delta = getVersionPathDelta(latestPath, versionedPath);
304
304
  const stripped = delta && stripVersionPathDelta(hrefPath, delta);
305
305
  if (stripped) {
306
306
  return stripped;
@@ -315,10 +315,19 @@ function hrefMatchesVersion(
315
315
  version: TopicVersionOption,
316
316
  versions: TopicVersionOption[]
317
317
  ): boolean {
318
- return hrefMatchesCurrentPage(applyVersionToHref(href, version, versions));
318
+ if (hrefMatchesCurrentPage(applyVersionToHref(href, version, versions))) {
319
+ return true;
320
+ }
321
+ // The server serves the latest under its canonical URL and also under
322
+ // `/<latestId>/`, so the versioned form must select the latest too.
323
+ return (
324
+ !!href &&
325
+ version.id === versions[0]?.id &&
326
+ hrefMatchesCurrentPage(insertVersionBeforeSlug(href, version.id))
327
+ );
319
328
  }
320
329
 
321
- function collectSubtreeCanonicalHrefs(
330
+ export function collectSubtreeCanonicalHrefs(
322
331
  node: VersionedNode,
323
332
  includeSelf = true
324
333
  ): string[] {