i get an error while finding a save post, but in the attribute the save exist under user.
error is: TypeError: Cannot read properties of null (reading 'find')
line: const savedPostRecord = currentUser?.save.find(
(record: Models.Document) => record.post.$id === post.$id
);
TL;DR
Developers are experiencing an error while attempting to find a saved post. The error message indicates a TypeError, specifically "Cannot read properties of null (reading 'find')." The problematic line of code is provided:
```const savedPostRecord = currentUser?.save.find(
(record: Models.Document) => record.post.$id === post.$id
);```
A possible solution could be to check if both `currentUser` and `currentUser.save` exist before attempting to call the `.find()` method. This could be achieved using conditional statements or optional chaining (`?.`).My user is: tonymelony
and project id = 65a321d6b97507a5464a
Recommended threads
- Database Write Limits hit
Hello Appwrite Admins, I'm a GitHub Education user, and about a week ago, my database was really badly optimized, resulting in about 600k writes in a single day...
- How i can call increment with operators ...
- Attribute not found in schema on REST AP...
I'm querying a appwrite collection via the REST API on appwrite cloud 1.9.5 (no SDK) via a cloudflare worker and keep getting: ``` {"message":"Invalid query: A...