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

StoreConnector distinct default value #68

Closed
smiLLe opened this issue Aug 2, 2018 · 5 comments
Closed

StoreConnector distinct default value #68

smiLLe opened this issue Aug 2, 2018 · 5 comments

Comments

@smiLLe
Copy link

smiLLe commented Aug 2, 2018

Hi,
i am using built_value which implements == and hashcode automatically. So whenever i use the StoreConnector i usually want distinct to be true.

What do you guys think about having something like a static StoreConnector.distinctDefault value
which then will be used as the default value in the constructor?

Oh and thanks for this great lib :)

@brianegan
Copy link
Owner

brianegan commented Aug 10, 2018

Hey there -- thanks for writing in, and sorry about the delay -- on vacation at the moment! Interesting proposal... I don't love the idea of global, mutable variables since they've always given me headaches in the end, but I can see why this functionality would be useful.

Lemme play around with a couple of options!

@smiLLe
Copy link
Author

smiLLe commented Aug 10, 2018

Hey, have a great vacation! :)

I also don't like the idea of having a global/static/mutable property.
What about subclassing StoreConnector to something like DistinctStoreConnector. It would expose the same constructor without the distinct property.

@brianegan
Copy link
Owner

brianegan commented Aug 15, 2018

Hey all :) Back from vacay.

Aight, so I could create a DistinctStoreConnector, but I wonder if that will save much typing overall? Another option: I could also create a factory, like StoreConnector.distinct(...). I actually prefer the second so the library is a bit easier to maintain. However, I'm not sure either of these will save much typing in the end.

E.g. DistinctStoreConnector(...) or StoreConnector.distinct aren't much shorter than StoreConnector(distinct: true, ...).

Unfortunately, I feel like providing a Global would save the most amount of typing. What are your thoughts?

@smiLLe
Copy link
Author

smiLLe commented Aug 27, 2018

Hey :) Sorry for the late response, i also was on vacation :)

I agree with StoreConnector.distinct - And you must still remember to use the factory.
Using a Global just does not feel good :( Let's close this Issue and wait if other people asking for the same feature?

@brianegan
Copy link
Owner

brianegan commented Aug 31, 2018

Cool, thanks @smiLLe :) I can add that in if more folks have such an interest. Hope ya had a good vacay!

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

No branches or pull requests

2 participants