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

Clear pending ops (revert) for Cloud Function validation "constant" #7534

Closed
3 tasks done
dblythy opened this issue Sep 1, 2021 · 5 comments
Closed
3 tasks done

Clear pending ops (revert) for Cloud Function validation "constant" #7534

dblythy opened this issue Sep 1, 2021 · 5 comments
Labels
type:feature New feature or improvement of existing feature

Comments

@dblythy
Copy link
Member

dblythy commented Sep 1, 2021

New Feature / Enhancement Checklist

Current Limitation

Parse Cloud Function validation field constant sets request.object's field to request.original. Wouldn't it be better to use Parse.Object's function .revert, to clear pending operations on these keys, rather than setting it?

Feature / Enhancement Description

I propose changing this block to:

request.object.revert(key);
if (request.object.get(key) == null &&opt.default != null) {
  request.object.set(key, opt.default);
}

Example Use Case

Alternatives / Workarounds

3rd Party References

@github-actions
Copy link
Contributor

github-actions bot commented Sep 1, 2021

Thanks for opening this issue!

  • 🎉 We are excited about your ideas for improvement!

@mtrezza
Copy link
Member

mtrezza commented Sep 1, 2021

Can you please fill out the other fields to make it more clear what the current issue is and what the benefit of the suggested change would be? I renamed "Parse Cloud Validator" as I assume it refers to Cloud Function validation.

@mtrezza mtrezza changed the title Clear pending ops (revert) for Cloud Validator "constant" Clear pending ops (revert) for Cloud Function validation "constant" Sep 2, 2021
@dblythy
Copy link
Member Author

dblythy commented Sep 3, 2021

It's only a minor nit @mtrezza, but if you use the constant property, the code will override req.object.key to req.original.key. This is a database op that doesn't need to happen, because effectively req.object.key isn't being changed. Hence why I think it should use the existing JS method req.object.revert(key), which removes pending OPS for req.object.key

@mtrezza
Copy link
Member

mtrezza commented Oct 15, 2021

@dblythy Hasn't there been a PR recently for this?

@mtrezza mtrezza added type:feature New feature or improvement of existing feature and removed type:improvement labels Dec 6, 2021
@dblythy
Copy link
Member Author

dblythy commented Mar 19, 2022

Depends on: #7839

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:feature New feature or improvement of existing feature
Projects
None yet
Development

No branches or pull requests

2 participants