-
Notifications
You must be signed in to change notification settings - Fork 15
adds optional options argument; adds deepmerge to options #4
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
Conversation
|
@developit @pl12133 this may be a solution looking for a problem, but addresses conflicts in which a non-primative prop is passed to a consuming component by multiple wrappers, and the consuming component would like the resulting prop to be a merged version |
|
@apeltz Totally forgot about this, I can review tomorrow. This is definitely an issue which creates very unexpected behavior so I might even prefer skipping |
|
To summarize the problem here: You create a So far so good, your Component gets an The problem surfaces when a component somewhere else in the tree adds additional keys to the nested object: Now, you may be expecting that However by adding As far as default behavior goes, it's extremely confusing. 👻 Rather than adding an option to disable it, I think we should probably move forward with a |
|
I forgot about this until now. Is this something we still think is useful? @pl12133 @Aneurysm9 |
|
Yup, we should definitely get this merged. I'm thinking mostly we just need to test it on some existing components and see if it breaks anything. |
|
Agreed with @pl12133 - the current behaviour was never meant to handle returning merged objects, only leaf values. |
|
It should be merged as a major semver update since it's breaking anyway. Then we can selectively update components to validate that nothing is broken or patch what is? |
|
Interestingly @billneff79 might have found a way to solve this at the |
pl12133
left a comment
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.
It runs, let's ship it as a beta! Thanks for working on this @apeltz
|
@pl12133 some updates in this latest commit:
|
|
@pl12133 I added some test cases that are more readable and also fixed an error in a docblock example use case I had. @billneff79 's synacor/preact-context-provider#3 does provide a path to accomplish the same thing that the functionality here does, but this addition will allow us to continue to use preconf as we currently are while without an additional provider wrapper. |
|
I believe this solves a similar, but different problem to synacor/preact-context-provider#3.
Part of me leans toward #3 as I find the default functionality redundant with the new capabilities provided by |
|
Going to close this PR after discussions with @billneff79 resulted in a new approach. |
|
To be clear, I think our new approach will be to take the functionality that preconf provides and move it more generically into a new function in |
No description provided.