Metadata
- Source
- FLUID-5586
- Type
- Bug
- Priority
- Major
- Status
- Closed
- Resolution
- Fixed
- Assignee
- Antranig Basman
- Reporter
- Antranig Basman
- Created
2015-01-13T16:12:21.603-0500 - Updated
2017-02-27T15:49:13.131-0500 - Versions
-
- 2.0
- Fixed Versions
- N/A
- Component
-
- Data Binder
- IoC System
Description
Our records, acceptable currently as invokers and listener records, which hold the fields "changePath" and "value" to declaratively encode changes, are incompletely implemented.
i) They don't support the "type" field for changes which means that changes of type DELETE can't be encoded
ii) They don't support a "changePath" of "" (or other falsy values such as 0) which implies that changes at model root can't be encoded
Comments
-
Antranig Basman commented
2015-08-20T14:21:40.166-0400 Astonishingly this is still unresolved in Infusion 2.0.0-beta.1
-
Colin Clark commented
2015-09-29T19:21:54.272-0400 In case others are confused, here is an example of a change path record that will fail due to the fact that we are doing a falsey check on the changePath attribute deep within the guts of the IoC system.
fluid.defaults("cat.hugo", { gradeNames: "fluid.modelComponent", model: {}, listeners: { onCreate: [ { changePath: "", value: { meow: "raow!" } } ] } });
Is the best workaround, currently, to use a listener specification like this instead?
{ func: "{that}.applier.change" args: [...] }
-
Antranig Basman commented
2015-09-30T04:00:42.791-0400 Now I think of it, the best workaround is actually to use a changePath of [] - array paths are better on several considerations than strings, since future versions of the framework will be able to easily support IoC references in place of segments, and this also sidesteps annoyances such as escaping issues - as well as being just a tiny bit faster.
-
Colin Clark commented
2015-09-30T10:54:02.523-0400 I'm probably just confused, but I modified my test like this:
{
changePath: [],
value: {
meow: "raow!"
}
}and I get an error inside fluid.parseValidModelReference() where it appears to assume that the changePath value will always be a string.
-
Antranig Basman commented
2016-03-01T13:59:01.381-0500 In the scheme implemented in pull request https://github.com/fluid-project/infusion/pull/671 , this is now supported by means of expressions like:
changePath: { segs: [], }, value: { meow: "raow!" }
(every place a model path is accepted in the framework now also accepts a structure holding {segs: <array>, context: <optional component path>} )