Fix date in LiveQuery event trigger#7174
Conversation
* commit 'ccb045b68c5b4d983a90fa125513fc476e4e2387': fix: upgrade @graphql-tools/links from 6.2.4 to 6.2.5 (parse-community#7007) fix: upgrade pg-promise from 10.7.0 to 10.7.1 (parse-community#7009) fix: upgrade jwks-rsa from 1.10.1 to 1.11.0 (parse-community#7008) fix: upgrade graphql from 15.3.0 to 15.4.0 (parse-community#7011) update stale bot (parse-community#6998) fix(beforeSave/afterSave): Return value instead of Parse.Op for nested fields (parse-community#7005) fix(beforeSave): Skip Sanitizing Database results (parse-community#7003) Fix includeAll for querying a Pointer and Pointer array (parse-community#7002) Init (parse-community#6999)
* commit '7f47b0427ea56214d9b0199f0fcfa4af38794e02': Add page localization (parse-community#7128) Improve contribution guide (parse-community#7075) fix: upgrade pg-promise from 10.9.0 to 10.9.1 (parse-community#7170) Add tests against multiple MongoDB versions (parse-community#7161) fix: upgrade mime from 2.4.7 to 2.5.0 (parse-community#7166) fix: upgrade pg-promise from 10.8.7 to 10.9.0 (parse-community#7168) fix: upgrade apollo-server-express from 2.19.1 to 2.19.2 (parse-community#7165) Upgrade @node-rs/bcrypt to latest version (parse-community#7159) Run Prettier after Definitions (parse-community#7164)
|
I'm not sure with the current Parse JS SDK can use |
|
Should be fixed by using the JS SDK master and: |
|
@dblythy I'll do a JS SDK release this weekend. |
|
@mtrezza The SDK has been merged. Can you update from master? |
|
Still fails, because of issue 1, but that may just be because of how the test case is written (toJSON -> fromJSON). |
|
If you rewrite your test using the third parameter of it('afterEvent should work with date', async done => {
await reconfigureServer({
liveQuery: {
classNames: ['TestObject'],
},
startLiveQueryServer: true,
});
Parse.Cloud.afterLiveQueryEvent('TestObject', request => {
const date = request.object.get('date');
expect(date).toBeDefined();
expect(date).toBeInstanceOf(Date);
done();
});
const query = new Parse.Query(TestObject);
await query.subscribe();
let object = new TestObject();
object.set('date', new Date());
const json = object.toJSON();
json.className = 'TestObject';
json.__type = 'Object';
object = Parse.Object.fromJSON(json, false, true); // this is the key line
await object.save();
}); |
|
I wasn't even aware that parameter exists, which surfaces yet another issue: TypeScript, still says: The test passes only with: but that is not something we should have in a test, because it is actually a workaround for another issue. To make the test pass, the JSON could be created manually: but that is also not something we should keep in this test, because it incorrectly assumes that the JSON syntax of What do you suggest? |
|
It is a new parameter recently released with V3 of the JS SDK, so that fromJSON can save data. Without it, no keys are set to I think this one will be fixed, but i'm not sure how to test. The issue happened when the decoder was passed a raw date instead of an Object with __type date. The object decoder had no provision to return the date, so instead it returned an empty object. This was happening at the |
|
|
Closed via parse-community/Parse-SDK-JS#1293 |
New Pull Request Checklist
Issue Description
Property of type
Dateisundefinedin LiveQuery afterEvent trigger.Related issue: closes #7082
Approach
Unknown, only added failing test case.
TODOs before merging