Skip to content
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions Development/src/dataProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,18 @@ const convertDataProviderRequestToHTTP = (
JsonPointer.set(patchData, `/${d.path.join('/')}`, d.rhs, true);
}

// the activation object in a PATCH requests an activation, rather
// than reflecting staged state, so when a mode is set, include it
// even if the staged endpoint already reported the same values,
// which otherwise leaves it out of the differences (see #97)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// the activation object in a PATCH requests an activation, rather
// than reflecting staged state, so when a mode is set, include it
// even if the staged endpoint already reported the same values,
// which otherwise leaves it out of the differences (see #97)
// Activation in a PATCH is a request, not staged state. Include it whenever
// the request has a non-null mode, even if GET /staged already reported the
// same values (otherwise deep-diff omits it). That also covers non-conformant
// devices that leave activate_immediate on /staged (see #97). A null mode is
// only sent when it appears in the differences, so unrelated edits do not
// cancel a pending activation.

if (get(params, 'data.$staged.activation.mode') != null) {
set(
patchData,
'activation',
get(params, 'data.$staged.activation')
);
}

if (has(patchData, 'transport_file')) {
if (get(patchData, 'transport_file.data') === null) {
set(patchData, 'transport_file.type', null);
Expand Down
Loading