Skip to content

Docs: redirect legacy settings anchors before rendering - #111760

Merged
Blargian merged 5 commits into
masterfrom
codex/fix-merge-tree-setting-anchor
Jul 24, 2026
Merged

Blargian merged 5 commits into
masterfrom
codex/fix-merge-tree-setting-anchor

Conversation

@Blargian

@Blargian Blargian commented Jul 24, 2026 •

Copy link
Copy Markdown
Member

Legacy external links to settings that moved onto generated detail pages now resolve their fragment before the settings explorer renders. This avoids briefly landing on the overview page and forwards links such as parts_to_throw_insert directly to the generated setting page.

The behavior is generated consistently for the Format, MergeTree, Server, and Session settings overview pages.

Changelog category (leave one):

  • Documentation (changelog entry is not required)

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Improved compatibility for external links to settings that moved from overview pages to generated detail pages.

Version info

  • Merged into: 26.8.1.86 (included in 26.8 and later)

@clickhouse-gh

clickhouse-gh Bot commented Jul 24, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [7b2e583]

Summary: ✅


AI Review

Summary

This PR moves legacy settings-fragment redirects out of the generated React explorers into a global client script plus per-family route maps. The base-path regression is fixed, but the PR still does not satisfy its advertised contract of redirecting legacy links before the overview page renders because the redirect still waits on an asynchronous route-map fetch.

Findings

⚠️ Majors

  • [docs/_site/customizations/settings-legacy-redirect.js:55-66] The redirect still depends on a dynamically inserted <script> to load the route map. On a cold cache or slow connection redirectLegacySettingAnchor returns false until that request finishes, so a direct hit on .../reference/settings/merge-tree-settings#parts_to_throw_insert can still paint the overview page before window.location.replace runs. That leaves the regression described in the PR body unfixed.
    Suggested fix: make the relevant route map synchronously available on the overview page, or bundle the four route maps into the initial global redirect script so the redirect can run before the overview content is shown.
Tests
  • ⚠️ The updated test_session_settings_split.py only checks generated strings and route-map artifacts. It does not exercise settings-legacy-redirect.js, so it would not catch the remaining async flash above. A minimal browser/runtime test should verify that a direct hit on one of the overview pages with a moved setting fragment redirects before the overview shell becomes visible.
Final Verdict
  • Status: ⚠️ Request changes

@clickhouse-gh clickhouse-gh Bot added the pr-documentation Documentation PRs for the specific code PR label Jul 24, 2026
if (redirectUrl) window.location.replace(redirectUrl);
}, [redirectUrl]);

if (redirectUrl) return null;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fragments are never sent to the server, so a direct request like /reference/settings/merge-tree-settings#parts_to_throw_insert still server-renders the overview with redirectUrl == null. The first client render then returns null here and window.location.replace only runs from useEffect, i.e. after hydration. That means the external-link path this PR cites still flashes the overview (and now hydrates to a different tree) instead of redirecting before the page renders. To actually fix that regression, the redirect has to run in an inline script or another pre-hydration/router layer rather than inside the React component.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated in 929dd5f. Mintlify does not execute the inline MDX script, so the generator now emits per-family route-map scripts and a supported global client script lazily loads the matching map before redirecting. I verified the external-style URL locally both with ?mintlify_preview=1 and without it; both land on /reference/settings/merge-tree-settings/parts-to#parts_to_throw_insert, preserving the query when present.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still needs an extra asynchronous fetch before the redirect can happen. In the current code, docs/_site/customizations/settings-legacy-redirect.js:54-60 creates a per-family <script> tag and only retries from script.onload, so a direct hit on .../merge-tree-settings#parts_to_throw_insert can still paint the overview page on a cold cache or slow connection before the route map arrives. To preserve the "before rendering" behavior from the original finding, the route map has to be available synchronously on the overview page (or in the initial global bundle) rather than fetched lazily after hash detection.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The current code still waits on an extra network fetch before it can redirect. In docs/_site/customizations/settings-legacy-redirect.js:55-66, redirectLegacySettingAnchor appends a per-family <script> and returns false until script.onload runs. On a cold cache or slow connection, a direct hit on .../reference/settings/merge-tree-settings#parts_to_throw_insert can therefore still paint the overview page before docs/_site/customizations/settings-legacy-redirect.js:78-80 reaches window.location.replace, so the original "before rendering" regression is still present.

@mintlify

mintlify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟢 Ready View Preview Jul 24, 2026, 10:45 AM

@Blargian Blargian changed the title Redirect legacy settings anchors before rendering Docs: redirect legacy settings anchors before rendering Jul 24, 2026
Render the fragment redirect as an inline script ahead of the settings overview body. This avoids changing the React hydration tree and redirects external legacy links before the overview can render.

Review: #111760 (comment)
Mintlify does not execute inline scripts emitted from MDX overview pages. Generate per-family route maps and load the matching map from the supported global client script before redirecting the legacy fragment. Preserve any query string so this works both during preview and after cutover.\n\nReview: https://github.com/ClickHouse/ClickHouse/pull/111760#discussion_r3644696443\nExample: https://clickhouse.com/docs/en/operations/settings/merge-tree-settings/#parts_to_throw_insert
Runtime-loaded route maps now use the same  base detection as the existing navigation asset loaders. Root-hosted previews continue to use root-relative asset paths.\n\nReview: #111760 (comment)
@Blargian
Blargian marked this pull request as ready for review July 24, 2026 12:29
@Blargian
Blargian enabled auto-merge July 24, 2026 12:38
@Blargian
Blargian added this pull request to the merge queue Jul 24, 2026
Merged via the queue into master with commit 3064810 Jul 24, 2026
179 checks passed
@Blargian
Blargian deleted the codex/fix-merge-tree-setting-anchor branch July 24, 2026 12:55
@robot-clickhouse-ci-2 robot-clickhouse-ci-2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 24, 2026
@mintlify

mintlify Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Preview deployment for your docs. Learn more about Mintlify Previews.

Project Status Preview Updated (UTC)
ClickHouse-docs 🟡 Building – Jul 24, 2026, 10:21 AM

alexey-milovidov added a commit that referenced this pull request Jul 25, 2026
Master rewrote the autogenerated format-settings explorer and legacy-route
files (#111760), reintroducing the obsolete setting
`input_format_orc_use_fast_decoder` into
`docs/snippets/components/FormatSettingsExplorer/FormatSettingsExplorer.jsx`
and `docs/_site/customizations/settings-legacy-routes/format-settings.js`.
Resolved the merge by taking the current master versions and re-running
`autogenerate_docs.py --only format-settings --write` with a binary built
from this branch, which drops the obsolete setting from the generated data
(and refreshes minor generator-output drift in `formats.mdx` and
`navigation.json`). `--check` mode passes on the result.
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Render the fragment redirect as an inline script ahead of the settings overview body. This avoids changing the React hydration tree and redirects external legacy links before the overview can render.

Review: ClickHouse#111760 (comment)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Runtime-loaded route maps now use the same  base detection as the existing navigation asset loaders. Root-hosted previews continue to use root-relative asset paths.\n\nReview: ClickHouse#111760 (comment)
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
…tree-setting-anchor

Docs: redirect legacy settings anchors before rendering
zeekay pushed a commit to hanzoai/datastore that referenced this pull request Sep 11, 2026
Master rewrote the autogenerated format-settings explorer and legacy-route
files (ClickHouse#111760), reintroducing the obsolete setting
`input_format_orc_use_fast_decoder` into
`docs/snippets/components/FormatSettingsExplorer/FormatSettingsExplorer.jsx`
and `docs/_site/customizations/settings-legacy-routes/format-settings.js`.
Resolved the merge by taking the current master versions and re-running
`autogenerate_docs.py --only format-settings --write` with a binary built
from this branch, which drops the obsolete setting from the generated data
(and refreshes minor generator-output drift in `formats.mdx` and
`navigation.json`). `--check` mode passes on the result.

This branch was successfully deployed

1 active deployment
staging - docs — 7b2e583e Deployed Jul 24, 2026 by mintlify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-documentation Documentation PRs for the specific code PR pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants