lukeed / lukeed/dset

Merging objects at the root results in a no-op

Open
#32 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
783
Forks
29
PR merge metrics
No merged PRs in 30d

Description

👋 I believe I have discovered a bug in this library based on GraphiQL usage of the library. If given:

import { dset } from "dset/merge"
let input = {};
dset(input, [], { hero: { id: "A" }});
console.log(input)
// output: {}
// expected: { hero: { id: "A" } }

In the case of GraphQL, this can happen if a field is deferred at the root level (example test case from the reference implementation).

Example commit with test case and a fix:
https://github.com/kirkbyo/dset/commit/ffc84ff8f98121cbf5df590c6917deb7936c4d52

Happy to open that commit as a PR here if you would prefer.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the dset/merge entry point and reproduce the provided JavaScript example with an empty path. Review the linked example commit for its test case and proposed behavior; done means merging into the root updates the input object as expected.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
tooling
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.