Skip to content

Stop oc.build from appending trailing slashes to hrefs#1521

Merged
ricardo-devis-agullo merged 1 commit into
masterfrom
stop-oc-build-trailing-slash
Jul 23, 2026
Merged

Stop oc.build from appending trailing slashes to hrefs#1521
ricardo-devis-agullo merged 1 commit into
masterfrom
stop-oc-build-trailing-slash

Conversation

@ricardo-devis-agullo

Copy link
Copy Markdown
Collaborator

Summary

Partial fix for #1515 focused on the browser client only.

oc.build no longer forces a trailing slash on the generated component href. Hrefs go from .../name/version/ to .../name/version, while still tolerating a baseUrl that already ends in /.

This is safe because:

  • Registry component routes are already registered without a trailing slash
  • Server-side urlBuilder.component() already emits no-slash URLs
  • oc.renderByHref uses the href as-is and does not depend on a final /

In scope

  • oc-client-browser oc.build URL construction
  • Unit/Playwright coverage for no trailing slash (with/without version, baseUrl trailing slash, params)
  • Docs example update
  • Changeset for oc-client-browser (minor)

Out of scope (still tracked in #1515)

  • Fastify adapter ignoreTrailingSlash option + default flip to false
  • Registry router route normalization / root redirect
  • Server-side componentPreview URL builder (.../~preview/)
  • Express adapter behavior
  • CDN/cache-key migration for previously emitted trailing-slash URLs

Fixes nothing end-to-end by itself for Fastify operators — it removes one first-party trailing-slash emitter so later registry/adapter work can default to strict routing safely.

Test plan

  • cd packages/oc-client-browser && npm test (244/244 passed)
  • Assertions pin no trailing slash when baseUrl ends with / and when version is present/absent

Does not close #1515 — leave it open until the remaining work lands.

Generated with Devin

Part of #1515: browser client no longer emits .../name/version/
URLs so Fastify strict routing works without ignoreTrailingSlash.

Generated with [Devin](https://devin.ai)

Co-Authored-By: Devin <158243242+devin-ai-integration[bot]@users.noreply.github.com>
@ricardo-devis-agullo
ricardo-devis-agullo merged commit 9308f5d into master Jul 23, 2026
3 checks passed
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.

Make Fastify adapter ignoreTrailingSlash configurable (default false) and stop OC from emitting trailing-slash URLs

1 participant