Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore/url-builder-client-server-compatible #859

Conversation

carlosallexandre
Copy link
Contributor

@carlosallexandre carlosallexandre commented Oct 11, 2024

Motivation

After investigating the issue #847, I found that url-builder is imported by a client component (Table component used by discover page). As url-builder depends on the trailingSlash config to generate the appropriately url, running the url-builder in browser environments causes the error mentioned in the issue.

A few client components use url-builder-client that doesn't rely on the @eventcatalog.config but needs the trailingSlash as a param. This brings a burden to the client component as it needs to know the trailingSlash needed only to the url-builder that is passed by a server component through props.

So, to remove the unneeded trailingSlash props and avoiding the duplication of url-builder this PR adds a global variable (__EC_TRAILING_SLASH__) that can be acessed by the url-builder in node/browser environments without any issue.

Fix #847.

Copy link

changeset-bot bot commented Oct 11, 2024

🦋 Changeset detected

Latest commit: a3767a2

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@eventcatalog/core Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

It adds the global variable to run url-builder utility either in
node and browser environments.
@carlosallexandre carlosallexandre force-pushed the chore/url-builder-client-server-compatible branch from 48f4616 to a4b16b8 Compare October 11, 2024 13:47
@carlosallexandre carlosallexandre marked this pull request as ready for review October 11, 2024 14:41
@boyney123
Copy link
Collaborator

Thank you @carlosallexandre such a better implementation and idea, didnt even know this was possible.

Thank you mate!

@boyney123 boyney123 merged commit 8376da8 into event-catalog:main Oct 16, 2024
4 checks passed
@carlosallexandre carlosallexandre deleted the chore/url-builder-client-server-compatible branch November 7, 2024 18:26
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.

Unable to search in discover tab, also unable to click next page
4 participants