Open GouthamGatla opened 22 hours ago
@GouthamGatla do you experience this in your local development setup? Is it reproducible?
This issue iam facing in local development setup and iam able to reproduce @jedelbo
Would you be able to share the realm file you are working on? I guess it is rather large?
/ eslint-disable prettier/prettier / import Realm from 'realm';
const surveyTaskSchema = { name: 'survey_task', primaryKey: 'id', properties: { id: 'string', mobileNumber: 'string', status: 'string', product: 'string?', productId: 'string?', fieldSurveyNumber: 'string?', policyNumber: 'string?', applicationNumber: 'string?', claimIntimationNumber: 'string?', state: 'string?', district: 'string?', subDistrict: 'string?', revenueCircle: 'string?', grampanchayat: 'string?', village: 'string?', insuredFarmerName: 'string?', farmerFatherName: 'string?', farmerMobileNumber: 'string?', farmerType: 'string?', ownershipType: 'string?', cropName: 'string?', cropSownArea: 'string?', insuredArea: 'string?', surveyNumber: 'string?', dateOfSowing: 'string?', dateOfLoss: 'string?', dateOfLossIntimation: 'string?', surveyType: 'string?', localisedCropStage: 'string?', localisedCauseOfLoss: 'string?', localisedOnFieldCropCondition: 'string?', localisedAffectedArea: 'string?', localisedLoss: 'string?', localisedNameOfGovtOfficer: 'string?', localisedDesignationOfGovtOfficer: 'string?', localisedContactNumberOfGovtOfficer: 'string?', localisedExpectedDateOfHarvest: 'string?', localisedComments: 'string?', postHarvestCropStage: 'string?', postHarvestCauseOfLoss: 'string?', postHarvestOnFieldCropCondition: 'string?', postHarvestAffectedArea: 'string?', postHarvestLoss: 'string?', postHarvestNameOfGovtOfficer: 'string?', postHarvestDesignationOfGovtOfficer: 'string?', postHarvestContactNumberOfGovtOfficer: 'string?', postHarvestExpectedDateOfHarvest: 'string?', postHarvestComments: 'string?', geoCoordinatedOfTheAffectedField: 'mixed?', imageWithFarmerAndGovtOfficialsPhoto: 'mixed?', entireFieldPhoto: 'mixed?', lossAffectedAreaPhoto: 'mixed?', lossAffectedPlantPhoto: 'mixed?', neighbourFieldPhoto: 'mixed?', farmerPhotoId: 'mixed?', farmerKhasraOrSurveyCopyPhoto: 'mixed?', famerBankPassBookPhoto: 'mixed?', surveyClaimFormFilledAndSignedPhoto: 'mixed?', fieldPolygonPhoto: 'mixed?', photoOfFieldAlongWitFarmer: 'mixed?', captureVideoOfAffectedArea: 'mixed?', surveyorName: 'string?', claimsTeamComments: 'string?', surveyStatus: 'string?', vendorName: 'string?', surveyorID: 'string?', vendorID: 'string?', surveyorMobileNumber: 'string?', villageLatitude: 'string?', villageLongitude: 'string?', submittedDate: 'string?', draftDate: 'string?', filledDate: 'string?', farmerTab: 'bool', eventTab: 'bool', surveyTab: 'bool', postSurveTab: 'bool', MediaTab: 'bool', }, };
const cropsSchema = { name: 'crops', primaryKey: 'product', properties: { product: 'string', cropNames: 'mixed[]', }, };
const perilsSchema = { name: 'perils', primaryKey: 'id', properties: { id: 'string', perilList: 'string[]', }, };
const realm = new Realm({ schema: [surveyTaskSchema, perilsSchema, cropsSchema], });
const handleRealmTransaction = async (transactionFn: any) => { try { realm.write(async () => { await transactionFn(); }); } catch (error) { console.error('Realm transaction error:', error); } };
export const createCropsInRealm = (data: any) => { handleRealmTransaction(() => { realm.create('crops', data); }); };
export const getCrops = (name: any) => {
try {
return realm.objects('crops').filtered(product == "${name}"
);
} catch (error) {
console.error('Error fetching crops:', error);
return [];
}
};
export const getAllCrops = () => { try { return realm.objects('crops'); } catch (error) { console.error('Error fetching all crops:', error); return []; } };
export const updateCrop = (productName: any, newCropNames: any) => { handleRealmTransaction(() => { const cropToUpdate = realm.objectForPrimaryKey('crops', productName); if (cropToUpdate) { cropToUpdate.cropNames = newCropNames; } else { console.log('Product not found'); } }); };
export const deleteAllCrops = () => { handleRealmTransaction(() => { const allCrops = realm.objects('crops'); realm.delete(allCrops); }); };
export const deleteSingleCrop = (name: any) => { handleRealmTransaction(() => { const productToDelete = realm.objectForPrimaryKey('crops', name); if (productToDelete) { realm.delete(productToDelete); } else { console.log('Product not found'); } }); };
export const deleteCropsByName = (cropName: any) => { handleRealmTransaction(() => { const productToDelete = realm.objectForPrimaryKey('crops', cropName); if (productToDelete) { realm.delete(productToDelete); } }); };
export const createPerilsInRealm = (data: any) => { handleRealmTransaction(() => { realm.create('perils', data); }); };
export const getRealmPerils = () => { try { return realm.objects('perils'); } catch (error) { console.error('Error fetching perils:', error); return []; } };
export const createTask = async (data: any) => { await handleRealmTransaction(() => { realm.create('survey_task', data); }); };
export const getSingleTask = (id: any) => { try { return realm.objects('survey_task').filtered('id == $0', id); } catch (error) { console.error('Error fetching single task:', error); return []; } };
export const updateTask = async (id: any, newData: any) => { await handleRealmTransaction(() => { const task = realm.objectForPrimaryKey('survey_task', id); if (task) { Object.keys(newData).forEach(key => { task[key] = newData[key]; }); } }); };
export const deleteAllTheTasks = () => { handleRealmTransaction(() => { const allSurveyTasks = realm.objects('survey_task'); realm.delete(allSurveyTasks); }); };
export const getAllValues = () => {
try {
return realm.objects('survey_task').filtered(status != "Synchronised"
);
} catch (error) {
console.error('Error fetching all values:', error);
return [];
}
};
export const getValuesByStatus = (statusValue: any) => {
try {
const query = status == "${statusValue}"
;
return realm.objects('survey_task').filtered(query);
} catch (error) {
console.error('Error fetching values by status:', error);
return [];
}
};
export const deleteSingleTask = (id: any) => { handleRealmTransaction(() => { const taskToDelete = realm.objectForPrimaryKey('survey_task', id); if (taskToDelete) { realm.delete(taskToDelete); } else { console.log('Task not found'); } }); };
/home/runner/work/realm-js/realm-js/packages/realm/bindgen/vendor/realm-core/src/realm/alloc.hpp:565: [realm-core-14.13.1] Invalid ref translation entry [0, 78187493520, 844629504, 12]