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 gravatar service calls #712

Merged
merged 6 commits into from
Dec 8, 2023
Merged

Fix gravatar service calls #712

merged 6 commits into from
Dec 8, 2023

Conversation

fgravin
Copy link
Member

@fgravin fgravin commented Dec 4, 2023

The gravatar service fetches the GN4 settings in the constructor, and then provides sync properties (profileIcon, placeholder), which

  • can be a source of error (race condition)
  • does not work in web component

The PR refactors the service to returns Observables instead of values, which are triggered only if a subscription is done.
This means that the fetch for the avatar setting does not occur in web components.

@fgravin fgravin added the bug Something isn't working label Dec 4, 2023
@fgravin fgravin requested a review from tkohr December 4, 2023 21:01
Copy link
Contributor

github-actions bot commented Dec 4, 2023

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

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

Copy link
Collaborator

@tkohr tkohr left a comment

Choose a reason for hiding this comment

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

Thanks for the fix and explanation @fgravin ! I've adapted the unit tests and added a small fix detected by the e2e tests. Works fine in webcomponents, datahub and editor on my side.

@coveralls
Copy link

Coverage Status

coverage: 85.849% (-0.1%) from 85.988%
when pulling d16f177 on fix-chart-wc
into f46b998 on main.

Copy link
Member Author

@fgravin fgravin left a comment

Choose a reason for hiding this comment

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

Great @tkohr thank you for taking over it.
I made a small comment, you can merge though.

@@ -12,7 +12,7 @@ export class GravatarService implements AvatarServiceInterface {
private GRAVATAR_IDENTICON = 'mp'

private readonly identicon$ = this.gn4SettingsService.identicon$.pipe(
map((identicon) => identicon.replace('gravatar:', ''))
map((identicon) => identicon?.replace('gravatar:', ''))
Copy link
Member Author

Choose a reason for hiding this comment

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

ok then is the undefined value is handled in the subscription of this observable ?

Copy link
Collaborator

Choose a reason for hiding this comment

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

yes, I think l.25 below should handle it

map((identicon) => identicon || this.GRAVATAR_IDENTICON),

@fgravin fgravin merged commit 17fd38f into main Dec 8, 2023
8 checks passed
@fgravin fgravin deleted the fix-chart-wc branch December 8, 2023 13:56
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.

3 participants