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

fix(entities): correct typing for selectActiveEntity #126

Merged
merged 1 commit into from
Jan 24, 2022

Conversation

davidsidlinger
Copy link
Contributor

PR Checklist

Please check if your PR fulfills the following requirements:

I am not sure if there should be a documentation update to accompany this.

PR Type

What kind of change does this PR introduce?

[x] Bugfix
[ ] Feature
[ ] Code style update (formatting, local variables)
[ ] Refactoring (no functional changes, no api changes)
[ ] Build related changes
[ ] CI related changes
[ ] Documentation content changes
[ ] Other... Please describe:

What is the current behavior?

The selectActiveEntity operator is typed such that the resulting observable appears to only ever emit an entity.

Issue Number: N/A

What is the new behavior?

The typing now reflects that the resulting observable can also emit undefined if there is no active entity or if the active ID doesn't match an entity in the store.

Does this PR introduce a breaking change?

[x] Yes
[ ] No

There is no breaking actual behavior change, but projects using selectActiveEntity could have broken builds due to the more correct typing information, especially projects that are more strict in their compilation.

Other information

@NetanelBasal
Copy link
Member

NetanelBasal commented Jan 24, 2022

I can't believe I missed it. Let's make it a breaking change. Can you please update the commit message to include a breaking change based on Conventional Commits?

@NetanelBasal
Copy link
Member

It would also be great if you could check if I've missed other queries.

@davidsidlinger
Copy link
Contributor Author

Sure thing on both counts. :)

The resulting observable can emit an entity or undefined.

BREAKING CHANGE: Usages of selectActiveEntity may need to be updated.
@davidsidlinger
Copy link
Contributor Author

Done on the commit message. I didn't see any other obvious similar problems.

@NetanelBasal NetanelBasal merged commit 49ac18f into ngneat:master Jan 24, 2022
NetanelBasal pushed a commit that referenced this pull request Jan 24, 2022
BREAKING CHANGE: selectActiveEntity is now stricter

`selectActiveEntity` is stricter and returns `Entity | undefined`
@davidsidlinger davidsidlinger deleted the fix/select-active-typing branch January 24, 2022 19:27
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 this pull request may close these issues.

2 participants