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

Can not mutate/add values to an array #29

Closed
alexberriman opened this issue Feb 17, 2023 · 1 comment · Fixed by #30
Closed

Can not mutate/add values to an array #29

alexberriman opened this issue Feb 17, 2023 · 1 comment · Fixed by #30
Assignees
Labels
bug Something isn't working released
Milestone

Comments

@alexberriman
Copy link
Owner

Description

When trying to add values to an array the value isn't mutated.

e.g. you would expect this test to pass:

it("updates an empty array", () => {
  const $ = new Collection<{
    color: string;
    contents: string[];
    animal: string;
  }>(
    [
      { color: "green", contents: ["apple"], animal: "gorilla" },
      { color: "red", contents: [], animal: "monkey" },
    ],
    { primaryKey: "color" }
  );

  $.get({ color: "red" })
    .set({ contents: ["orange", "banana"], animal: "giraffe" })
    .commit();

  expect($.get({ color: "red" }).data).toEqual({
    animal: "giraffe",
    color: "red",
    contents: ["orange", "banana"],
  });
});

However after mutation the value of contents is still an empty array.

@alexberriman alexberriman added the bug Something isn't working label Feb 17, 2023
@alexberriman alexberriman added this to the v1.0 milestone Feb 17, 2023
@alexberriman alexberriman self-assigned this Feb 17, 2023
@alexberriman
Copy link
Owner Author

🎉 This issue has been resolved in version 0.3.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant