My React Native application encounters an error when subscribing to realtime events. The error message reads as follows:
ERROR Error: URLSearchParams.set is not implemented, js engine: hermes.
appwriteClient
.subscribe(
`databases.${APPWRITE_DATABASE_ID}.collections.${APPWRITE_OPPORTUNITIES_COLLECTION_ID}.documents`,
(response: any) => {
if (response.events.includes(
'databases.*.collections.*.documents.*.create'
)) {
setOpportunities((prevOpportunities: any[]) => {
const updatedOpportunity = [...prevOpportunities, ...response.payload];
return updatedOpportunity;
})
} else if (response.events.includes(
'database.*.collections.*.documents.delete'
)) {
setOpportunities((prevOpportunities: any[]) => {
return prevOpportunities.filter((opportunity) => {
return opportunity.$id !== response.payload.$id
})
})
}
})
I am seeking a solution to effectively monitor changes in the opportunity collection and promptly update my state upon reflection of updates or creations. How can I efficiently manage appwrite event subscriptions to resolve the URLSearchParams error?