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

Fixes some potential bug with mapping lenses #910

Merged
merged 1 commit into from
Oct 21, 2024

Conversation

Lysander
Copy link
Collaborator

The pimped className-function (introduced by PR #823 in 1.0-RC15 release) did not apply exception handling. That could lead to errors, if there is code that removes some element:

The independent reactive renderings could simply lead to corner cases, where a lens will try to access its mapped object (e.g. by mapByElement) that is no longer part of the stored model. So a
CollectionLensGetException will be thrown and must be handled by the consuming code.

This PR adds such exception handling code and a unit test to verify the new, correct behaviour.

@Lysander Lysander added the bug Something isn't working label Oct 21, 2024
@Lysander Lysander added this to the 1.0-RC20 milestone Oct 21, 2024
@Lysander Lysander requested a review from haukesomm October 21, 2024 09:56
@Lysander Lysander self-assigned this Oct 21, 2024
The pimped `className`-function (introduced by PR #823 in `1.0-RC15` release) did not apply exception handling. That could lead to errors,
if there is code that removes some element:

The independent reactive renderings could simply lead to corner cases,
where a lens will try to access its mapped object (e.g. by `mapByElement`)
that is no longer part of the stored model. So a
`CollectionLensGetException` will be thrown and must be handled by the
consuming code.

This PR adds such exception handling code and a unit test to verify
the new, correct behaviour.
@Lysander Lysander force-pushed the chausknecht/add-classname-exception-handling branch from 9010c5c to 7a582ea Compare October 21, 2024 10:44
@Lysander Lysander merged commit fc099ae into master Oct 21, 2024
2 checks passed
@Lysander Lysander deleted the chausknecht/add-classname-exception-handling branch October 21, 2024 15:07
Lysander added a commit that referenced this pull request Oct 22, 2024
The pimped `className`-function (introduced by PR #823 in `1.0-RC15` release) did not apply exception handling. That could lead to errors,
if there is code that removes some element:

The independent reactive renderings could simply lead to corner cases,
where a lens will try to access its mapped object (e.g. by `mapByElement`)
that is no longer part of the stored model. So a
`CollectionLensGetException` will be thrown and must be handled by the
consuming code.

This PR adds such exception handling code and a unit test to verify
the new, correct behaviour.

Co-authored-by: christian.hausknecht <christian.hausknecht@oeffentliche.de>
(cherry picked from commit fc099ae)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants