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

Default value not working for queries #3

Closed
javierbrea opened this issue Jun 14, 2019 · 3 comments · Fixed by #11
Closed

Default value not working for queries #3

javierbrea opened this issue Jun 14, 2019 · 3 comments · Fixed by #11
Assignees
Labels
bug Something isn't working

Comments

@javierbrea
Copy link
Member

Currently, when defining a default value for a Memory storage, it returns the expected value when reading the root object, but, when querying the source to get an specific property, it has as value the full object defined as default value too, not the value of the queried property:

import { Memory } from "xbyorange/mercury-memory";

const fooOrigin = new Memory({
  fooProperty: "foo",
  fooProperty2: "foo2"
});

console.log(fooOrigin.read.value); //=> {fooProperty:"foo", fooProperty2: "foo2"}
console.log(fooOrigin.query("fooProperty").read.value; //=> {fooProperty:"foo", fooProperty2: "foo2"}

It is desirable that, when querying an specific property, it returns the value of that property as default value, not the full object:

console.log(fooOrigin.query("fooProperty").read.value; //=> "foo"
@javierbrea javierbrea added the bug Something isn't working label Jun 14, 2019
@javierbrea javierbrea added this to To do in mercury-memory via automation Jun 14, 2019
@javierbrea
Copy link
Member Author

FYI @juanmagit

@javierbrea
Copy link
Member Author

Dependent of XbyOrange/mercury#5

@javierbrea javierbrea moved this from To do to In progress in mercury-memory Oct 15, 2019
@javierbrea javierbrea self-assigned this Oct 15, 2019
@javierbrea javierbrea added this to the release v2.0.0 milestone Oct 15, 2019
@javierbrea javierbrea moved this from In progress to Done in mercury-memory Oct 15, 2019
@javierbrea javierbrea moved this from Done to In progress in mercury-memory Oct 15, 2019
@javierbrea javierbrea moved this from In progress to Ready for release in mercury-memory Oct 15, 2019
@javierbrea javierbrea mentioned this issue Oct 15, 2019
@javierbrea javierbrea modified the milestones: release v2.0.0, release v1.2.0 Oct 16, 2019
@javierbrea
Copy link
Member Author

In order to avoid breaking changes, this new behavior should be activated using a new option called "queriesDefaultValue". A warning will be traced if this option is not received until next major version, in which the option will be deprecated and the described behavior will be the default one.

mercury-memory automation moved this from Ready for release to Done Oct 16, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Development

Successfully merging a pull request may close this issue.

1 participant