-
Notifications
You must be signed in to change notification settings - Fork 26
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
pass logger to filter for time consuming information #3296
base: main
Are you sure you want to change the base?
Conversation
Deploying nmrium with Cloudflare Pages
|
176128e
to
9a5936a
Compare
98fe26b
to
f2f6772
Compare
@@ -176,6 +178,7 @@ function KeysListenerTracker(props: KeysListenerTrackerProps) { | |||
type: 'DELETE_EXCLUSION_ZONE', | |||
payload: { | |||
zone, | |||
logger, | |||
}, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We need to ensure the reducer function remains pure. Passing the logger to the reducer introduces a side effect, which we should avoid. This issue has been consistently repeated across all the PRs you submitted
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should lift the function up that requires the logger as a parameter to the callback function and pass its result down to the reducer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We have a reducer that for example apply apodization on a spectrum. Apodization being done by nmr-processing.
We would like that nmr-processing can log some information (time spend in each filter) in the logger
.
Problem is that the logger is changing another part of the state and this is not expected to be done in a reducer.
@targos Do you have some suggestions how to solve this issue ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hamed said it all. You need to do the processing outside of the reducer and send the result to the reducer. A reducer is not supposed to do heavy work. Just take some data and update the state with it.
No description provided.