Hi Ambroise,
I am glad to share that I have managed to solve this problem. The data is getting updated in the DB. (However, there is another problem now, which I’ll talk about below)
Here are a few directions I took to debug the issue:
-
Possibly the custom event can’t change things that is passed to them, but it rather changes in their copy: This theory WAS WRONG. If you pass a thing to a custom event and it makes edits to it, they would reflect in DB.
-
Possibly the things can’t be changed when they are accessed as custom state rather than being queried from DB directly: This theory WAS WRONG too. This is the “second question” mentioned in my original post. If you have a custom state which has a type of “thing”, and then you assign a thing to it, then even if you make edits to it, they would get reflected in corresponding thing in the DB. This is good that it behaves this way.
-
Possibly a user can’t edit a thing after logging in while the thing was created when he was not logged in: This theory was very likely right. What I was trying was that user submitted an enquiry form and if he was not logged in, I was forcing them to login. After logging in, I was taking thing created before logging in (stored via cookie) and then making edits to it. But since the logged in user and non logged in user are not same, the edits even though were reflecting in debugger, they were not reflecting in DB. Now what I am doing is I am creating a new thing when user logs in, and am copying the value from non logged in enquiry to this one. It is working! Big learning!
-
Possibly “JS to Bubble” is not getting set: I am doing some javascript calculations to compute pricing, so that I can assign it to the enquiry thing. Earlier I was storing this price in the DB thing and it was not getting stored. However, the “JS to Bubble” value is not being set as I would expect it to. This is the problem I am stuck at now. I have mentioned it in this thread. If you have some insights, please do comment there.
Thanks for your time into looking into this thread. I am just sharing my learning, in case they are helpful to you or someone else in future.
Thanks,
Mukesh