Repository navigation
Docs: redirect legacy settings anchors before rendering - #111760
Conversation
|
Workflow [PR], commit [7b2e583] Summary: ✅ AI ReviewSummaryThis 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
Tests
Final Verdict
|
| if (redirectUrl) window.location.replace(redirectUrl); | ||
| }, [redirectUrl]); | ||
|
|
||
| if (redirectUrl) return null; |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
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)
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
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.
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)
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)
…tree-setting-anchor Docs: redirect legacy settings anchors before rendering
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.
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_insertdirectly to the generated setting page.The behavior is generated consistently for the Format,
MergeTree, Server, and Session settings overview pages.Changelog category (leave one):
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
26.8.1.86(included in26.8and later)