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

Race condition in processing directories and files #2

Open
alexewerlof opened this issue Jun 7, 2021 · 0 comments
Open

Race condition in processing directories and files #2

alexewerlof opened this issue Jun 7, 2021 · 0 comments

Comments

@alexewerlof
Copy link
Owner

This bug affects all previous versions of combine-json.

If a folder has the following structure:

/parent
  child.json // { "x": "X", "y": "Y" }
  /child/a.json
  /child/b.json
  /child/c.json

Depending on which one gets processed first, the result may be partial. For example if the order is this:

  /child/a.json
  child.json
  /child/b.json
  /child/c.json

Then whatever is set in a.json is ignored. This is due to how lodash.set() works:

const o = {}
_.set(o, ['a', 'b', 'c'], { foo_c: 'bar_c' })
// { a: { b: { c: { foo_c: "bar_c" } } } }
_.set(o, ['a', 'b'], { foo_b: 'bar_b' })
// { a: { b: foo_b: "bar_b" } } } }
// notice that foo_c disappeared!
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

1 participant