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

Only run after and enrich interceptors against an effect db, not coeffect db #453

Closed
danielcompton opened this issue Feb 19, 2018 · 0 comments · Fixed by #511
Closed

Only run after and enrich interceptors against an effect db, not coeffect db #453

danielcompton opened this issue Feb 19, 2018 · 0 comments · Fixed by #511

Comments

@danielcompton
Copy link
Contributor

Following on from #447 and #450, it was discovered that there is probably not a lot of point in running after or enrich interceptors against a coeffect db if an effect db wasn't returned. This is technically a breaking API change, but I'd be surprised if it affected anyone.

Current behaviour

If an event handler doesn't return a db effect, an after or enrich interceptor is run against the db coeffect.

Proposed behaviour

If an event handler doesn't return a db effect, no after or enrich interceptor is run.

frenata added a commit to frenata/re-frame that referenced this issue Oct 28, 2018
Previously both standard interceptors acted upon the `db` *coffect* if
no *effect* was available. Per day8#453 and related discussion, there is little
reason in general to do this, since this context means that the `app-db`
should not change.

Both functions are changed to explicitly check for the presence of the
`db` effect. If it is not present in the context, the interceptor
function is not run.

The previous functionality around `nil` and `false` values for the `db`
effect is preserved: the interceptors *are* run in this case. Tests are
added to verify the behavior of both functions in the case of
non-presence, falsey and truthy values.

The relevant docstrings are tweaked to accomodate this change.

Closes day8#453.
frenata added a commit to frenata/re-frame that referenced this issue Oct 28, 2018
Previously both standard interceptors acted upon the `db` *coeffect* if
no *effect* was available. Per day8#453 and related discussion, there is little
reason in general to do this, since this context means that the `app-db`
should not change.

Both functions are changed to explicitly check for the presence of the
`db` effect. If it is not present in the context, the interceptor
function is not run.

The previous functionality around `nil` and `false` values for the `db`
effect is preserved: the interceptors *are* run in this case. Tests are
added to verify the behavior of both functions in the case of
non-presence, falsey and truthy values.

The relevant docstrings are tweaked to accommodate this change.

Closes day8#453.
frenata added a commit to frenata/re-frame that referenced this issue Oct 28, 2018
Previously both standard interceptors acted upon the `db` *coeffect* if
no *effect* was available. Per day8#453 and related discussion, there is little
reason in general to do this, since this context means that the `app-db`
should not change.

Both functions are changed to explicitly check for the presence of the
`db` effect. If it is not present in the context, the interceptor
function is not run.

The previous functionality around `nil` and `false` values for the `db`
effect is preserved: the interceptors *are* run in this case. Tests are
added to verify the behavior of both functions in the case of
non-presence, falsey and truthy values.

The relevant docstrings are tweaked to accommodate this change.

Closes day8#453.
frenata added a commit to frenata/re-frame that referenced this issue Oct 28, 2018
Previously both standard interceptors acted upon the `db` *coeffect* if
no *effect* was available. Per day8#453 and related discussion, there is little
reason in general to do this, since this context means that the `app-db`
should not change.

Both functions are changed to explicitly check for the presence of the
`db` effect. If it is not present in the context, the interceptor
function is not run.

The previous functionality around `nil` and `false` values for the `db`
effect is preserved: the interceptors *are* run in this case. Tests are
added to verify the behavior of both functions in the case of
non-presence, falsey and truthy values.

The relevant docstrings are tweaked to accommodate this change.

Closes day8#453.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant