forcedotcom / SalesforceMobileSDK-Android

Android SDK for Salesforce
Other
342 stars 388 forks source link

Issue with removeFromSoup Method: NoSuchKeyException: querySpec #2596

Closed imransiddiquirn closed 3 months ago

imransiddiquirn commented 3 months ago

I am encountering an issue with the removeFromSoup method in the SmartStore React Native integration. The method fails with a NoSuchKeyException error when attempting to delete entries from a soup using entry IDs.

Details:

Version of Mobile SDK Used:

SDK: v12.0.1 React Native: "0.73.6",

Android 13 Device:

Call the deleteFromSoup method with a soup name and an array of entry IDs.

Example: deleteFromSoup('tcpl_secondarySalesOrder__c', ['16']) .then(result => console.log('Success:', result)) .catch(error => console.error('Error:', error)); Actual Behavior:

The method fails with the following error: SmartStoreReactBridge.removeFromSoup failed: "com.facebook.react.bridge.NoSuchKeyException: querySpec"

SmartStoreReactBridge.removeFromSoup failed: "com.facebook.react.bridge.NoSuchKeyException: querySpec" Code Details:

export const deleteFromSoup = (soupName: any, entries: Array<string>) => { return new Promise<SqlResponseI>((resolve, reject) => { // Check if smartstore object is properly initialized if (!smartstore) { reject(new Error('SmartStore is not initialized.')); return; } // Check if smartstore.removeFromSoup() is available before invoking it if (!smartstore.removeFromSoup) { reject(new Error('SmartStore does not have removeFromSoup method.')); return; } smartstore.removeFromSoup(false, soupName, entries, (suc: any) => { resolve(suc); }, err => { console.log(error while deleting from soup '${soupName}', err); reject(err); } ); }); };

wmathurin commented 3 months ago

This issue has been fixed in dev in will be in our next release (12.1). See https://github.com/forcedotcom/SalesforceMobileSDK-Android/pull/2586

NewTech2000 commented 3 months ago

Same Issue in SDK 12.0.0

2586 added these changes but there is casting issue

wmathurin commented 2 months ago

Can you give us more details? What casting issue are you running into?

NewTech2000 commented 2 months ago

@wmathurin here is the casting issue after adding the above changes. ERROR Error removing from store: java.lang.ClassCastException: java.util.ArrayList cannot be cast to java.lang.Double