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

[🚀 esl-event-listener]: (POC) condition property to legally prevent subscription #1947

Closed
ala-n opened this issue Sep 24, 2023 · 1 comment · Fixed by #1958
Closed

[🚀 esl-event-listener]: (POC) condition property to legally prevent subscription #1947

ala-n opened this issue Sep 24, 2023 · 1 comment · Fixed by #1958
Assignees
Labels

Comments

@ala-n
Copy link
Collaborator

ala-n commented Sep 24, 2023

As an ESL event listener module consumer, I want to be more predictable in subscription handling in case of conditional subscription.

Current state:

@listen({
    event: (that: any) => that.shouldSubscribe ? 'event' : ''
})
onEvent() {
}

works perfectly but is not so readable and produces a console working that the result subscription is empty.

Proposal:

@listen({
    event: 'event',
    condition: (that: any) => that.shouldSubscribe
})
onEvent() {
}

More transparent declaration of the conditional event listening.
The warning in the console is now much more probably related to an issue, as the condition will reflect the real state of things.

Discussions:

  • In the current state, two things can lead to an empty subscription -> falsy/empty event or falsy/empty target
    There are real cases when the target is null/empty - and it is related to some problem direct or indirect.
    Most likely, there are no known cases when null/empty event was not produced with direct purpose.
    Open questions: should we consider the nullable event as an issue to warn about?
    If no should we add condition field proposed in bounce of that topic?
    Discussion result: consider empty even as warning, the issue description is actual
@ala-n ala-n self-assigned this Sep 24, 2023
@ala-n ala-n added the feature New feature label Sep 24, 2023
@ala-n ala-n added this to the ⚡ESL: 4.13.0 Minor release milestone Sep 24, 2023
ala-n added a commit that referenced this issue Sep 26, 2023
ala-n pushed a commit that referenced this issue Oct 25, 2023
# [4.13.0](v4.12.0...v4.13.0) (2023-10-25)

### Bug Fixes

* **esl-media:** fix brightcove provider autoplay marker flow ([58793cd](58793cd)), closes [#1979](#1979)
* **esl-popup:** fix default styles for `esl-popup` tag (uninitialized) ([e25eedf](e25eedf))
* **esl-popup:** update popup position according activator change ([#1679](#1679)) ([65e3801](65e3801))
* **esl-scrollbar:** fix incorrect `at-start`/`at-end` handling when browser creates dimensions with the floating point ([852ad15](852ad15))
* **esl-share:** add a fill color to social network icons ([c0d62ac](c0d62ac))
* **esl-share:** change default twitter (x.com) icon and bg color ([8c544e4](8c544e4))
* **esl-share:** show copy notification just in case it is successful ([f57fe98](f57fe98))
* **esl-utils:** fix `debounce` helper random access of undefined ([8cd87e8](8cd87e8))

### Features

* **esl-event-listener:** add `condition` descriptor property to legally prevent subscription ([00b719c](00b719c)), closes [#1947](#1947)
* **esl-event-listener:** create `ESLIntersectionTarget` adapter utility for managing `IntersectionObserver` subscriptions trough event listeners ([34bb7e8](34bb7e8))
* **esl-share:** add default-icon marker to render icon on button init ([081b526](081b526))
* **esl-share:** add out of the box share config default ([4b97632](4b97632))
* **esl-share:** create esl-share-list component ([90b1c1d](90b1c1d))
* **esl-share:** remove iconBackground property from share buttons config ([27d793d](27d793d))
* **esl-share:** rework esl-share-button custom element API ([96a7f84](96a7f84))
* **esl-share:** rework share popup internal implementation ([9b775a0](9b775a0))
@ala-n
Copy link
Collaborator Author

ala-n commented Oct 25, 2023

🎉 This issue has been resolved in version 4.13.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

@ala-n ala-n added the released label Oct 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
1 participant