Skip to content

feat(content-preview): add metadataApiHost prop for regional metadata#4614

Closed
mborkowski-box wants to merge 2 commits into
box:masterfrom
mborkowski-box:feat/mdx-2049-metadata-api-host
Closed

feat(content-preview): add metadataApiHost prop for regional metadata#4614
mborkowski-box wants to merge 2 commits into
box:masterfrom
mborkowski-box:feat/mdx-2049-metadata-api-host

Conversation

@mborkowski-box

@mborkowski-box mborkowski-box commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Summary by CodeRabbit

Release Notes

  • New Features

    • Added optional metadataApiHost configuration to ContentPreview and ContentSidebar components for routing metadata instance requests to regional endpoints.
  • Tests

    • Added comprehensive test coverage for regional metadata request routing behavior.
  • Documentation

    • Updated component documentation to document the new metadataApiHost prop and its regional routing behavior.

@mborkowski-box mborkowski-box force-pushed the feat/mdx-2049-metadata-api-host branch from fe750c3 to 044e95c Compare June 8, 2026 19:04
@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

Important

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 5f2a9536-82dd-449c-b8d2-6cb0a75a7239

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Walkthrough

This PR adds optional metadataApiHost configuration to enable routing metadata instance endpoints (file and folder metadata) to a regional API host. The feature flows from type definitions through API layer routing logic to UI component props, with comprehensive tests and documentation at each layer.

Changes

Regional Metadata API Host Support

Layer / File(s) Summary
API Configuration & Type Definitions
src/common/types/api.js, src/api/Base.js
APIOptions type gains optional metadataApiHost field; Base class adds metadataApiHost instance field, accepts it in the constructor, stores it in this.options, and introduces buildApiUrl(host) helper to construct normalized API URLs with /2.0 suffix and trailing-slash handling.
Metadata Instance Routing Logic
src/api/Metadata.js, src/api/__tests__/Metadata.test.js
Metadata class adds getMetadataInstanceBaseUrl() helper to choose the host for instance endpoints based on metadataApiHost when set and distinct from apiHost, otherwise falling back to getBaseApiUrl(). Methods getMetadataUrl() and getMetadataUrlForFolder() now route through this helper. Tests verify regional routing, fallback behavior, trailing-slash normalization, and that other metadata endpoints (templates, suggestions, options, taxonomies) remain on apiHost.
ContentPreview Component Integration
src/elements/content-preview/ContentPreview.js, src/elements/content-preview/__tests__/ContentPreview.test.js, src/elements/content-preview/stories/ContentPreview.mdx
ContentPreview accepts optional metadataApiHost prop, wires it into the API client options, and forwards it to LoadableSidebar. Tests verify forwarding and back-compat when omitted. Documentation describes the prop's role for regional metadata instance endpoints.
ContentSidebar Component Integration
src/elements/content-sidebar/ContentSidebar.js, src/elements/content-sidebar/__tests__/ContentSidebar.test.js, src/elements/content-sidebar/stories/ContentSidebar.mdx
ContentSidebar accepts optional metadataApiHost prop, passes it into API client initialization. Tests verify prop acceptance, forwarding, and backward compatibility. Documentation describes the prop's scope for metadata instance endpoints.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Suggested labels

ready-to-merge

Suggested reviewers

  • dlasecki-box
  • reneshen0328
  • tjuanitas

Poem

🐰 A regional hop, across the API gate,
Where metadata instances celebrate their fate,
From component prop to routing layer deep,
Backward-compatible promises we keep,
One metadataApiHost, seamlessly in place!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 inconclusive)

Check name Status Explanation Resolution
Description check ❓ Inconclusive The PR description contains only a template/boilerplate note about merge procedures without substantive information about the actual changes or implementation details. Add a description explaining what metadataApiHost does, why it was added, which components are affected, and any migration notes or testing guidance for reviewers.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately describes the main change: adding a metadataApiHost prop for regional metadata support across multiple components.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Comment thread i18n/en-US.properties Outdated
@mborkowski-box

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 8, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@mborkowski-box mborkowski-box force-pushed the feat/mdx-2049-metadata-api-host branch from f915c32 to 48a5be7 Compare June 8, 2026 19:59
Co-authored-by: Cursor <cursoragent@cursor.com>
@mborkowski-box mborkowski-box force-pushed the feat/mdx-2049-metadata-api-host branch from 48a5be7 to 10d4711 Compare June 8, 2026 20:01
Co-authored-by: Cursor <cursoragent@cursor.com>
@mborkowski-box mborkowski-box deleted the feat/mdx-2049-metadata-api-host branch June 9, 2026 09:19
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.

1 participant