Comments (4)
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.
from parse-sdk-js.
I did make this hacky fix locally to fix the problem and it does, but not sure if its the best fix:
fixParse.ts
type QueueObject = {
queueId: string;
action: string;
object: Parse.Object;
serverOptions: any;
id: string;
className: string;
hash: string;
createdAt: Date;
};
console.info('Fixing Parse...');
// @ts-ignore
Parse.EventuallyQueue.enqueue = async function (
action: string,
object: Parse.Object,
serverOptions: any,
): Promise<void> {
console.log(`Enqueueing ${action} for ${object.id}`);
const queueData = await this.getQueue();
// @ts-ignore
const queueId = this.generateQueueId(action, object);
// @ts-ignore
let index = this.queueItemExists(queueData, queueId);
if (index > -1) {
// Add cached values to new object if they don't exist
for (const prop in queueData[index].object) {
if (typeof object.get(prop) === 'undefined') {
object.set(prop, queueData[index].object[prop]);
}
}
} else {
index = queueData.length;
}
queueData[index] = {
queueId,
action,
// @ts-ignore
object: object._getSaveJSON(),
serverOptions,
id: object.id,
className: object.className,
hash: object.get('hash'),
createdAt: new Date(),
};
// @ts-ignore
return this.setQueue(queueData);
};
// @ts-ignore
Parse.EventuallyQueue.sendQueueCallback = async function (
object: Parse.Object,
queueObject: QueueObject,
): Promise<void> {
if (!object) {
// @ts-ignore
return this.remove(queueObject.queueId);
}
switch (queueObject.action) {
case 'save':
// Queued update was overwritten by other request. Do not save
if (
typeof object.updatedAt !== 'undefined' &&
object.updatedAt > queueObject.createdAt
) {
// @ts-ignore
return this.remove(queueObject.queueId);
}
try {
await object.save(
queueObject.object,
queueObject.serverOptions,
);
// @ts-ignore
await this.remove(queueObject.queueId);
} catch (e) {
if (
e.message !==
'XMLHttpRequest failed: "Unable to connect to the Parse API"'
) {
// @ts-ignore
await this.remove(queueObject.queueId);
}
}
break;
case 'destroy':
try {
await object.destroy(queueObject.serverOptions);
// @ts-ignore
await this.remove(queueObject.queueId);
} catch (e) {
if (
e.message !==
'XMLHttpRequest failed: "Unable to connect to the Parse API"'
) {
// @ts-ignore
await this.remove(queueObject.queueId);
}
}
break;
}
};
export {};
from parse-sdk-js.
@mortenmo Do you want to open a pull request?
from parse-sdk-js.
Related Issues (20)
- Add NativeScript support HOT 2
- Add support for MongoDB Atlas `$search` operator HOT 1
- `Query.findAll()` doesn't use `exclude`/`excludeKeys` HOT 2
- Add context container in `Parse.Cloud.beforeLogin` and `Parse.Cloud.afterLogin` HOT 2
- Query only works after any update on Dashboard HOT 11
- ParseObject 'unset' in Parse.Cloud.run cloud is not updated on client HOT 3
- Parse.Cloud.httpRequest is not a function HOT 2
- saveEventually - "code":209,"stack":"Error: Session token is expired" HOT 7
- Expand TypeScript support HOT 9
- Lock closed threads HOT 1
- API Reference Documentation not updated HOT 1
- SDK throws error in web contexts where calling into `window.indexedDB` is prohibited, but not undefined on the window HOT 2
- Calling `.add` multiple times on relations is broken HOT 4
- Refused to get unsafe header "access-control-expose-headers" on Chrome HOT 14
- Allow for REST Content Override for Server protection HOT 2
- Align currently supported Node.js version HOT 4
- `Parse.User.verifyPassword` does not pass request options to server HOT 5
- Parse SDK 4.3.1 is not working with React Native / Expo HOT 9
- Expo RN and ParseLiveQuery EventEmitter error HOT 13
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from parse-sdk-js.