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

Fix web components which rely on API version #612

Merged
merged 2 commits into from
Sep 8, 2023
Merged

Fix web components which rely on API version #612

merged 2 commits into from
Sep 8, 2023

Conversation

fgravin
Copy link
Member

@fgravin fgravin commented Sep 8, 2023

Angular Services should never call a gn4API function on Service initialization, because for web component, the API_URL is not defined yet.

One should use cold Observable instead, to be sure that the API is fetched only if subscribed.

This fixes the Web components runtime.

@fgravin fgravin added the bug Something isn't working label Sep 8, 2023
@fgravin fgravin added this to the 2.0.0 milestone Sep 8, 2023
AuthService and BrowserDynamicModule
For web components, the API_URL is not defined yet during Angular Service initialization.
Use cold Observable instead to avoid calling an API while not subscribed yet
@github-actions
Copy link
Contributor

github-actions bot commented Sep 8, 2023

Affected libs: api-repository, feature-catalog, feature-record, feature-router, feature-search, feature-map, feature-dataviz, feature-auth,
Affected apps: webcomponents, metadata-editor, datahub, demo, search, map-viewer, datafeeder,

  • 🚀 Build and deploy storybook and demo on GitHub Pages
  • 📦 Build and push affected docker images

Copy link
Collaborator

@jahow jahow left a comment

Choose a reason for hiding this comment

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

Ok, I understand; the HTTP calls are already cold observables, but since the functions are called right away they use the API url before initialization. Thanks for the simple fix!

@fgravin fgravin merged commit f46783c into main Sep 8, 2023
@fgravin fgravin deleted the fix-wc branch September 8, 2023 12:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants