Skip to content

remove deep-assign dependency #392

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

Simek
Copy link
Contributor

@Simek Simek commented Jun 19, 2020

Summary:

Fixes #374

Screenshot_2020-06-19_at_00 32 05

This PR removes deprecated deep-assign package dependency and replaces its functionality with the simple native ES code.

Since there is only one place where this method is used and it is a simple usage I have decided to not implement target as spread argument.

I'm happy to improve/put more work into this PR if it's needed.

Test Plan:

From the several tests I have conducted for all of the cases the result of deep-assign and new merge function were exactly the same.

Snack playground:

@@ -8,13 +8,22 @@
* @flow
*/

import merge from 'deep-assign';
const merge = (target = {}, source = {}) => {
Copy link
Member

@krizzu krizzu Jun 22, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since this is our own implementation, could you export this function (and write a comment that it's being exported for tests only) and write some tests? To make sure this works as expected

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had started working on the requested changes but it looks like there is already an own, native implementation of deep merge in the code:

Can this code be moved into main file? What is the best approach in this situation?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I forgot about that code there 😊 But this should not be a problem in that case - the _deepMerge function is used in Mock function. What I meant in my request was to write tests for merge function only, to check if it properly merges objects together.

I guess we could try to reuse merge in mock itself, but I'm not sure if that's good approach - the mock has no external (or even internal) dependencies, and I'd like to keep it that way

Copy link
Contributor Author

@Simek Simek Jun 24, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm a little bit afraid that I don't fully understand your test plan or your testing approach. I happy to help with fixing the initial issue and the basic tests but don't want to spend a lot of time working on the full test suite for this change.

So there are three options I consider:

  • ditching both native implementations (in code and in mock) in favor of one of recommended replace packages (this would not require creating test suite, but this still will require avoidable dependency),
  • leaving native merge as is and include/copy tests from the deep-merge package,
  • closing this PR as is right now with an offer to help when someone decide to tackle this issue again in the future.

Let me know what's your opinion about that.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm okay with changing the dependency to something else (more tested and used), than having own implementation, so that we save time on writing proper implementation and tests.

@krizzu
Copy link
Member

krizzu commented Aug 28, 2020

Working with @Simek, we came to conclusion it's better to leave it as a dependency for now, due possible breaking changes (and how library is created).

@krizzu krizzu closed this Aug 28, 2020
@nicolasscard
Copy link

Any notice with this deprecated dependency ?

@tido64
Copy link
Member

tido64 commented Jul 28, 2021

There's a new attempt here: #601

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.

Warning: deep-assign is deprecated
4 participants