influxdata / influxdata/docs-v2

PR preview Cloud pages can render blank when v3 wayfinding modal is omitted

Open
#7,430 0 comments 0 reactions 1 assignee Claimed by @jstirnaman View on GitHub
bug
Dominant language
JavaScript
Stars
82
Forks
326
Avg merge
1d 1h
Merged PRs (30d)
82

Description

## Problem

Some valid PR-preview pages render blank even though the generated HTML exists and contains page content.

Observed on PR #7428 for these preview URLs:

- https://influxdata.github.io/docs-v2/pr-preview/pr-7428/influxdb/cloud/reference/cli/influx/config/create/
- https://influxdata.github.io/docs-v2/pr-preview/pr-7428/influxdb3/cloud-serverless/reference/cli/influx/config/create/
- https://influxdata.github.io/docs-v2/pr-preview/pr-7428/influxdb/cloud/reference/cli/influx/config/set/
- https://influxdata.github.io/docs-v2/pr-preview/pr-7428/influxdb3/cloud-serverless/reference/cli/influx/config/set/

The corresponding production URLs return `200`, and local Hugo output includes the pages. Fetching the PR-preview HTML also returns `200` and includes the expected page content.

## Console error

In Playwright, the Cloud preview page logs:

```text
TypeError: Cannot set properties of null (setting 'onclick')
at initialize9 (https://influxdata.github.io/docs-v2/pr-preview/pr-7428/js/main.js:7865:26)
at initModules (.../js/main.js:14521:3)
at HTMLDocument.init (.../js/main.js:14526:3)
```

## Likely cause

`layouts/partials/footer.html` derives `$product` and `$version` from `.RelPermalink` using positional path segments:

```go-html-template
{{ $productPathData := findRE "[^/]+.*?" .RelPermalink }}
{{ $product := index $productPathData 0 }}
{{ $version := index $productPathData 1 | default "v2" }}
```

For PR previews, the page URL includes the prefix `/docs-v2/pr-preview/pr-7428/`, which shifts the expected path segments. As a result, the footer condition that emits `footer/v3-wayfinding.html` may not run for Cloud and Cloud Serverless preview pages.

Meanwhile, the client-side page context still detects the page as Cloud from `window.location.pathname`, so `assets/js/v3-wayfinding.js` initializes and tries to attach handlers to missing elements such as `#v3-wayfinding-stay`.

## Expected behavior

Valid PR-preview pages should render normally regardless of the `/docs-v2/pr-preview/pr-N/` prefix.

The footer/modal emission logic and the client-side wayfinding initialization should agree on whether the v3 wayfinding modal exists.

## Possible fixes

- Derive footer product/version from page params such as `.Page.Params.product` and `.Page.Params.version` instead of positional URL segments.
- Or make `assets/js/v3-wayfinding.js` no-op safely when the modal root or required controls are absent.

## Validation notes

For PR #7428:

- All affected production URLs returned `200`.
- All affected PR-preview URLs returned `200`.
- PR-preview HTML contained the expected page content and corrected `--username-password` table row.
- Browser rendering failed on affected Cloud preview pages because of the missing-wayfinding-element runtime exception.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.