Skip to content

fix: remove hydration error and Scalar spec.url deprecation warning - #588

Merged
g-despot merged 3 commits into
mainfrom
fix/feedback-hydration-scalar-url
Oct 30, 2026
Merged

g-despot merged 3 commits into
mainfrom
fix/feedback-hydration-scalar-url

Conversation

@databyjp

Copy link
Copy Markdown
Contributor

What's being changed:

Fixes two console messages on docs.weaviate.io.

1. React hydration error #418 on every doc page (src/components/Feedback/index.js)

The Feedback ("Ask AI") widget read localStorage in its useState initializers. On the server, isVisible was false, so the widget rendered nothing. In the browser's first render, it returned the Ask AI <button>. React logged Minified React error #418 (component stack at button) and re-rendered that tree on the client.

The widget now renders inside Docusaurus's <BrowserOnly>, so it mounts after hydration with its saved state. Both call sites in src/theme/DocItem/Layout/index.js are unchanged.

2. Scalar deprecation warning on /weaviate/api/rest and /engram/api/rest (docusaurus.config.js)

[DEPRECATED] You're using the deprecated 'spec.url' attribute. Remove the spec prefix and move the 'url' attribute to the top level.

url moves from configuration.spec.url to configuration.url. @scalar/docusaurus passes configuration unchanged to Scalar.createApiReference.

Not in this PR: Scalar's document validation errors warning on the REST page. 26 Swagger definitions in static/specs/weaviate-openapi.json have properties but no type: object. Fixing that belongs upstream in weaviate/weaviate or in the overlay under _build_scripts/openapi/.

Type of change:

  • Bug fix (non-breaking change to fixes an issue with the site)

How has this been tested?

  • Local build: ran docusaurus build for this branch and for main, served each build, and loaded pages in headless Chromium (Playwright). The test used docusaurus build rather than yarn start.
Page main This branch
/weaviate React error #418 No error, Ask AI button renders
/weaviate/search/hybrid, /cloud (not run on main) No error, Ask AI button renders
/weaviate/api/rest spec.url deprecation warning No warning, reference renders
/engram/api/rest (not run on main) No warning, reference renders

Hiding the widget (feedbackWidgetVisible=false in localStorage) and the expanded state were not tested.

🤖 Generated with Claude Code

The Feedback widget read localStorage in its useState initializers, so the
server rendered nothing while the first client render returned the Ask AI
button. React logged error #418 on every doc page and re-rendered the tree
on the client. Render the widget inside BrowserOnly so it mounts after
hydration.

Move the Scalar `url` option out of the deprecated `spec` object for both
API reference pages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

@orca-security-eu orca-security-eu Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Orca Security Scan Summary

Status Check Issues by priority
Passed Passed Infrastructure as Code high 0   medium 0   low 0   info 0 View in Orca
Passed Passed SAST high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Secrets high 0   medium 0   low 0   info 0 View in Orca
Passed Passed Vulnerabilities high 0   medium 0   low 0   info 0 View in Orca

databyjp and others added 2 commits October 30, 2026 11:01
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@databyjp
databyjp requested a review from g-despot October 30, 2026 11:07
@g-despot
g-despot merged commit 5d06378 into main Oct 30, 2026
12 of 13 checks passed
@g-despot
g-despot deleted the fix/feedback-hydration-scalar-url branch October 30, 2026 19:11
g-despot pushed a commit that referenced this pull request Nov 2, 2026
* Scaffold Markdown export interfaces and plan

Interface-only checkpoint for review: route-to-.md path mapping, the
HTML-to-Markdown conversion contract, the postBuild plugin contract and
the Accept-negotiation edge function contract. Every function throws
"Not implemented"; nothing is registered in docusaurus.config.js or
declared in netlify.toml, so builds and deploys are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Add image rules to Markdown export contract; record review decisions

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Serve a Markdown version of every docs page

Build: a postBuild plugin (src/plugins/markdown-export) converts each
rendered docs page to <route>.md, keeping every code tab variant with
its label, admonitions as GitHub alerts, KaTeX source, images, and
Mermaid source (exposed by a theme wrapper, since Mermaid renders in
the browser). A conversion error fails the build.

Discovery: docs pages get <link rel="alternate" type="text/markdown">
and a visually hidden notice. The markdown-negotiation edge function
serves the .md to requests whose Accept header prefers text/markdown
and falls back to the normal response when no .md exists.

Tests run with node --test and in the PR workflow. The commented-out
signalwire llms-txt config is removed; the package itself still needs
`yarn remove`.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* chore: remove unused @signalwire/docusaurus-plugin-llms-txt dependency

* Fix Markdown export defects found by QA of the rspack build

- Table cells with block content keep one line per block, joined by <br>.
- Cards that are one big link keep their content and get one link,
  labelled with the button text.
- Font Awesome icons no longer leave empty `**` emphasis.
- Admonition and details titles keep their links; bold inside a title is
  unwrapped instead of nested.
- Mermaid source travels URI-encoded in data-markdown-content: the rspack
  HTML minifier turned the text `&amp;&lt;br>` into a <br> element.
- DeploymentCards stage tabs are marked data-copy-exclude.
- IdAnatomy hides its grid from screen readers and the export, and adds a
  visually hidden list grouped by part.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Export the Scalar REST API reference pages as Markdown

Scalar renders /weaviate/api/rest and /engram/api/rest in the browser, so
their HTML has nothing to convert. The plugin now converts each Scalar
page's spec file (static/specs/*.json) with @scalar/openapi-to-markdown:

- /weaviate/api/rest.md: introduction, then each tag's operations and a
  link to its file; /weaviate/api/rest/<tag>.md: the full reference for
  one tag. The whole document is about 490 KB, too large for one fetch.
- /engram/api/rest.md: the whole reference, as its spec declares no tags.

Both pages also get <link rel="alternate"> tags for the Markdown and the
spec. The converter requires Node 22.19, so engines.node is raised.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Fix Markdown export issues found by the HTML/Markdown spot-check

- Mark the "Questions and feedback" heading data-copy-exclude with a
  remark plugin. Its section body is already excluded, so 327 Markdown
  files and the "Copy page" output ended with an empty heading.
- Cards with a title and description become `[Title](url): Description`
  instead of two links to the same URL.
- Fragment links get the page URL, because Markdown headings lose custom
  heading IDs such as #no-vector.
- Badge links under code blocks become one `See also:` line instead of
  links run together.
- ErrorDocs step numbers are data-copy-exclude, so the Markdown no longer
  reads "1. 1".

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Address review: redirected .md lookups, inline buttons, Node note

- The edge function fetches the .md with redirect: "manual". A moved
  page's .md path can match a wildcard redirect (/weaviate/schema/* to
  /weaviate/manage-collections); following it served that page's HTML
  as Markdown with status 200, instead of the page's own redirect.
- A button inside a paragraph keeps its text, so the quickstarts read
  "use the Ask AI feature" instead of "use the feature".
- The README states the Node version the tests need.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Markdown export: unpadded tables and shortened vector literals

Iteration 1 of the weval docs evaluation, to cut the tokens agents
spend reading the Markdown pages without changing what they say.

- Tables no longer pad each cell to its column's widest cell
  (remark-gfm tablePipeAlign: false). Padding was 53% of
  release-notes.md and 7% of the whole export.
- A bracketed list of 16 or more numbers in a code block keeps its
  first three values and "...", with an italic sentence after the
  block. Across the build this matches only the 300- and 1,536-number
  embedding vectors, which were 72% of custom-vectors.md and 40% of
  hybrid.md. The snippets run as tests, so the source and HTML keep
  the full vectors.

Measured on the same build/*.html, the 393 docs pages shrink by 10.2%:
release-notes.md 28,044 -> 12,382 characters, custom-vectors.md
80,881 -> 21,965, env-vars.md 132,001 -> 49,332.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* Markdown export: read the Scalar spec URL from configuration.url

#588 moved Scalar's `url` out of the deprecated `spec` object, so the
export found no API reference pages. Read `configuration.url`, and keep
`spec.url` as the fallback.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

* [HUMAN] Pre-merge edits

* Minor housekeeping edits

* Keep // request paths on the docs origin

---------

Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants