parse-server icon indicating copy to clipboard operation
parse-server copied to clipboard

Cloud code: Dirty flag on properties always returnes false.

Open degenddy opened this issue 10 years ago • 11 comments

In Cloud code when using "is dirty" method on a property on any PatseObject, it will always return false. The cloud code I'm running is working as expected on parse hosted server, so this is an issue with this code.

degenddy avatar Feb 22 '16 22:02 degenddy

Probably best to give example code, and if anything shows up in the parse server logs, if not enable VERBOSE = 1 as an environment variable that might spit out more info.

gateway avatar Feb 22 '16 22:02 gateway

Nothing special actually. Setting a numeric property in the android parse sdk. Saving object. Before save in cloud code, exec is dirty method on that object, giving that property name ==> returns false.

As I mentioned, the parse hosted server works as expected. There it'll return true.

degenddy avatar Feb 23 '16 06:02 degenddy

There's some work to be done here to match the hosted cloud code functionality. Some of this was done in parse-cloud-express for webhook usage and just needs to be implemented here.

gfosco avatar Feb 23 '16 06:02 gfosco

Ok thanks! Waiting for a fix.

degenddy avatar Feb 23 '16 07:02 degenddy

any ETA on this?

degenddy avatar Feb 23 '16 19:02 degenddy

No ETA just yet, you are very welcome to jump in and look into ways to fix it, but I am going to tackle this today/tomorrow.

nlutsenko avatar Feb 23 '16 22:02 nlutsenko

Got the working solution for object updates, but looks like we also expose dirtyKeys() for created objects - working on the solution right now.

nlutsenko avatar Feb 24 '16 01:02 nlutsenko

Hi, is this fixed?

degenddy avatar Feb 24 '16 15:02 degenddy

Fixed, coming in the next version.

nlutsenko avatar Feb 24 '16 17:02 nlutsenko

The opposite happens with me. dirty seems to be always returning true (in beforeSave) and that's causing problems with my cloud code logic (version 2.1.5).

xissburg avatar Mar 13 '16 00:03 xissburg

If the object was mutated for a save - it should be dirty, since the changes are not yet applied. This behavior is consistent with parse.com implementation, so I don't think we should change it. @xissburg, let's try debugging and fixing your logic together, you can open another issue or we can continue here...

nlutsenko avatar Mar 13 '16 00:03 nlutsenko