Skip to content

Pointers are stripped out after calling .save #7912

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

Closed
4 tasks done
dblythy opened this issue Mar 31, 2022 · 1 comment
Closed
4 tasks done

Pointers are stripped out after calling .save #7912

dblythy opened this issue Mar 31, 2022 · 1 comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed

Comments

@dblythy
Copy link
Member

dblythy commented Mar 31, 2022

New Issue Checklist

Issue Description

Since #7839, when .save is called on an object with a Pointer, all fields are cleared out on the pointer.

Steps to reproduce

  it('Pointer should not be cleared by triggers', async () => {
    Parse.Cloud.afterSave('MyObject', () => {
    });
    const foo = await new Parse.Object('Test', {foo: 'bar'}).save();
    const obj = await new Parse.Object('MyObject', {foo}).save();
    const foo2 = obj.get('foo');
    expect(foo2.get('foo')).toBe('bar')
  });

  it('Can set a pointer in triggers', async () => {
    Parse.Cloud.beforeSave('MyObject', () => {
    });
    Parse.Cloud.afterSave('MyObject', async ({object}) => {
      const foo = await new Parse.Object('Test', {foo: 'bar'}).save();
      object.set({foo});
      await object.save(null, {useMasterKey: true});
    }, {skipWithMasterKey: true});
    const obj = await new Parse.Object('MyObject').save();
    const foo2 = obj.get('foo');
    expect(foo2.get('foo')).toBe('bar')
  });

Actual Outcome

Tests fail

Expected Outcome

Tests should pass

Environment

Server

  • Parse Server version: alpha
  • Operating system: macos
  • Local or remote host (AWS, Azure, Google Cloud, Heroku, Digital Ocean, etc): localhost

Database

  • System (MongoDB or Postgres): mongodb
@parse-github-assistant
Copy link

Thanks for opening this issue!

  • 🚀 You can help us to fix this issue faster by opening a pull request with a failing test. See our Contribution Guide for how to make a pull request, or read our New Contributor's Guide if this is your first time contributing.

@mtrezza mtrezza added the type:bug Impaired feature or lacking behavior that is likely assumed label Mar 31, 2022
@dblythy dblythy closed this as completed May 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type:bug Impaired feature or lacking behavior that is likely assumed
Projects
None yet
Development

No branches or pull requests

2 participants