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

clock in split #537

Closed
igorkamyshev opened this issue Oct 20, 2021 · 5 comments
Closed

clock in split #537

igorkamyshev opened this issue Oct 20, 2021 · 5 comments
Labels
core effector package enhancement New feature or request RFC Request for Comments

Comments

@igorkamyshev
Copy link
Member

Proposal

Add clock to split.

Use case

All use cases from guard and sample with clock 🌚

@igorkamyshev igorkamyshev added the RFC Request for Comments label Oct 20, 2021
@zerobias
Copy link
Member

Great idea 👍 Indeed, there is an evidence that most of the api methods should share clock and fn properties. I’m currently investigating how we would improve split types thereby allowing introduction of this feature

@zerobias zerobias added core effector package enhancement New feature or request labels Oct 21, 2021
zerobias added a commit that referenced this issue Oct 29, 2021
this commit should fail
related issue #537
zerobias added a commit that referenced this issue Oct 29, 2021
@zerobias zerobias added this to the effector 22.2.0 milestone Nov 24, 2021
@zzzorgo
Copy link

zzzorgo commented Aug 16, 2024

@zerobias Hi, I couldn't find in the docs and by playing around with split how to get the payload of the event passed as clock to split? I am always getting undefined when trying to access it the same way as with the sample

@YanLobat
Copy link
Member

@zzzorgo unfortunately clock is available in split as a trigger only, payload passes from source field

@zzzorgo
Copy link

zzzorgo commented Aug 17, 2024

@YanLobat Thank you for you response! Could you please also clarify whether payload of clock is omitted by design or it is just a thing in the backlog? If it is by design what is the motivation?

I will elaborate a bit why I am asking: I have the case where an event (event1) is fired by, lets say, a react component. This event should split into two events (event2 and event3) depending on the store's current state and pass its payload to the target. I have two workaround to achive the same outcome:

  1. Using sample to generate an event carring both store's state and event1 payload and use it as a source inside split (without using clock) - the downside is that this solution is quite wordy especially considering the fact that split has clock already but just not passes the paylod of it
  2. Using two independant samples instread of split - the downside is that this solution doesn't convey the idea of splitting the event into two events as split does

@YanLobat
Copy link
Member

@zzzorgo clock payload is omitted due to the complexity of the implementation atm. but surely it's a future backlog!

yeah if it not possible to have all the necessary payload in source only, remained clock field void, then I suppose to use 2nd option.
imo these 2 options are more or less the same.

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core effector package enhancement New feature or request RFC Request for Comments
Projects
None yet
Development

No branches or pull requests

4 participants