add support for event source for reshape#295
Open
ifeelBALANCED wants to merge 1 commit intoeffector:mainfrom
Open
add support for event source for reshape#295ifeelBALANCED wants to merge 1 commit intoeffector:mainfrom
reshape#295ifeelBALANCED wants to merge 1 commit intoeffector:mainfrom
Conversation
|
|
🚛 size-compare reportComparing 97763341...97763341 Files wasn't changed
|
sergeysova
reviewed
Sep 17, 2023
sergeysova
requested changes
Sep 17, 2023
Comment on lines
+32
to
+35
| const tempStore = createStore<Type | null>(null); | ||
| sample({ source: source, filter: Boolean, target: tempStore }); | ||
|
|
||
| result[key] = tempStore.map(mapUnit(fn)); |
Member
There was a problem hiding this comment.
What do you think, not changing the meaning of the operator, and returning an object of events if passed event? Otherwise, we need to change the type of the value (| null) to correctly create a store for each key.
So, I don't understand the case where we need to create stores from the event. We can use restore
const shape = reshape({
source: restore(eventSource, null),
shape: {
length: (original) => original?.length ?? null,
uppercase: (original) => original?.toUpperCase() ?? null,
hasSpace: (original) => original?.includes(' ') ?? null,
},
})Or use any other default value.
I see the case for event -> event mapping for reshape:
const result = reshape({
source: eventSource,
shape: {
length: (original) => original.length,
uppercase: (original) => original.toUpperCase(),
hasSpace: (original) => original.includes(' '),
},
});
is.event(result.length) // trueHere we don't have to change the type of the shape (reshape shape.length returns number, so result.length has the same type).
reshape
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Add event source support for reshape operator