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

Patching a thing with a null value in JSON body is not reflected in the UI in real time #1712

Closed
kosta777 opened this issue Aug 9, 2023 · 1 comment · Fixed by #1773
Closed
Assignees
Labels
bug UI Issues related to the Ditto explorer UI
Milestone

Comments

@kosta777
Copy link

kosta777 commented Aug 9, 2023

When sending a patch request to Ditto in a JSON merge patch format and using a null specifier to request a deletion of a JSON key from the thing, if said thing was already selected in the UI console, it does not get updated right away to reflect this removal. In order to see whether the removal happened, one needs to either refresh the page, or deselect and select the thing in question again.

Considering that adding or modifying things via patch requests results in the selected thing in the UI being updated right away, I suspect this could be a bug.

For example, a patch request with the following body would result in the updated "brewingTemp" being visible right away in the UI for the selected thing, but "brewed-coffees" would also be visible until a page is refreshed, or the thing was deselected and selected again.

{
    "features" : {
        "coffee-brewer":{
           "properties":{
               "brewed-coffees": null, //remove key
               "brewingTemp":87 //update value
           }
        }
    }
}
@thjaeckle thjaeckle added bug UI Issues related to the Ditto explorer UI labels Aug 11, 2023
@thjaeckle
Copy link
Member

Thanks for reporting, @kosta777

I think that is due to the nature of Ditto's Server Sent Event API which the Ditto UI makes use of.
When something is deleted, the SSE will only get a notification like:

{}

What could help is to provide some kind of optional "context" (e.g. with the original Ditto Protocol information) when subscribing to the SSE.
I will look into this ..

thjaeckle added a commit that referenced this issue Oct 15, 2023
…the thing on the UI

* fixed by solving the merge on Ditto server side, selecting all "extraFields" for each change .. that way, the complete updated thing is emitted via the SSE instead only the diff
* as a result, also deleted the "merge" functionality of the UI, also removed no-longer needed "lodash" dependency

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
@thjaeckle thjaeckle added this to the 3.4.0 milestone Oct 15, 2023
thjaeckle added a commit that referenced this issue Oct 15, 2023
…the thing on the UI

* fixed by solving the merge on Ditto server side, selecting all "extraFields" for each change .. that way, the complete updated thing is emitted via the SSE instead only the diff
* as a result, also deleted the "merge" functionality of the UI, also removed no-longer needed "lodash" dependency

Signed-off-by: Thomas Jäckle <thomas.jaeckle@beyonnex.io>
@thjaeckle thjaeckle self-assigned this Nov 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug UI Issues related to the Ditto explorer UI
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

2 participants