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

feat(elements): add broadcast channel to sync icons with wc #14498

Merged
merged 7 commits into from
Aug 6, 2024

Conversation

MayaKirova
Copy link
Contributor

@MayaKirova MayaKirova commented Jul 9, 2024

…en angular and wc.

Goes with: IgniteUI/igniteui-webcomponents#1295

Closes #

Additional information (check all that apply):

  • Bug fix
  • New functionality
  • Documentation
  • Demos
  • CI/CD

Checklist:

  • All relevant tags have been applied to this PR
  • This PR includes unit tests covering all the new code (test guidelines)
  • This PR includes API docs for newly added methods/properties (api docs guidelines)
  • This PR includes feature/README.MD updates for the feature docs
  • This PR includes general feature table updates in the root README.MD
  • This PR includes CHANGELOG.MD updates for newly added functionality
  • This PR contains breaking changes
  • This PR includes ng update migrations for the breaking changes (migrations guidelines)
  • This PR includes behavioral changes and the feature specification has been updated with them

Copy link
Member

@damyanpetev damyanpetev left a comment

Choose a reason for hiding this comment

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

Can consider re-targeting to 18.1.x so this can be used with the next xplat releases, especially if we move the service to elements and it doesn't affect the main Angular project at all.

@MayaKirova MayaKirova changed the base branch from master to 18.1.x July 31, 2024 10:39
Copy link
Member

@damyanpetev damyanpetev left a comment

Choose a reason for hiding this comment

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

Besides the usage/lifecycle comment that's not important right now, the rest LGTM.

],
// bootstrap: []
})
export class AppModule {

constructor(private injector: Injector) {}
constructor(private injector: Injector, private _iconBroadcast: IgxIconBroadcastService) {}
Copy link
Member

Choose a reason for hiding this comment

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

Okay, kind of better we're keeping this in Elements for now.
A bit awkward in terms of usability as it stands having to inject just to trigger the functionality. So it either doesn't need to go through the DI system or perhaps we should consider some API on it like start & stop basically - both to make sense as usage and to have a cleanup mechanism.
Alternatively, since this isn't root-provided it should be able to take advantage of ngOnDestroy for cleanup.
Both of those things technically don't matter much for Elements, since this module will never destroy until the entre app does, but still should be noted.


if (message.actionType === ActionType.SyncState ||
message.actionType === ActionType.UpdateIconReference) {
this.updateRefsFromCollection(message.references);
Copy link
Member

Choose a reason for hiding this comment

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

Assuming it's the responsibility of the other side to only emit the icons that do need changing for UpdateIconReference?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. The other side sends the state of the collections and this side updates its own state.

Copy link
Member

Choose a reason for hiding this comment

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

Hehe, then it's not a "yes" answer :) The question was if "the other side to only emits the icons that do need changing".
If the other side sends the entire state of the collections, every API for change on that side will also cause the Angular side to re-register all previous icons for example, which is at least redundant if it doesn't affect performance much.

Copy link
Member

Choose a reason for hiding this comment

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

Nvm, checked the implementation, the other side creates a fresh collection for each change, so it is sending just the modified refs. No need to break-check me like that 😄

@dkamburov dkamburov added the ✅ status: verified Applies to PRs that have passed manual verification label Aug 6, 2024
@damyanpetev damyanpetev changed the title feat(IgxIconService): POC - Add broadcast channel to sync icons betwe… feat(elements): add broadcast channel to sync icons with wc Aug 6, 2024
@damyanpetev damyanpetev merged commit 6fd1067 into 18.1.x Aug 6, 2024
4 checks passed
@damyanpetev damyanpetev deleted the mkirova/poc-icon-service-sync branch August 6, 2024 16:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💠 grid: elements version: 18.1.x ✅ status: verified Applies to PRs that have passed manual verification
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants