Back

Outdated user data after profile update

  • 0
  • React Native
NETOx
29 Oct, 2024, 17:25

I'm experiencing an issue with updating user data in my application. After performing a profile update, such as name, email, or phone number, the data returned by the database still shows the old information, even after you try to fetch it again with getCurrentUser

// Get Current User export async function getCurrentUser() { try { const currentAccount = await account.get(); if (!currentAccount) throw Error;

TypeScript
const currentUser = await databases.listDocuments(
  appwriteConfig.databaseId,
  appwriteConfig.userCollectionId,
  [Query.equal("accountId", currentAccount.$id)]
);

if (!currentUser) throw Error;

return currentUser.documents[0];

} catch (error) { console.log(error); return null; } }

TL;DR
Outdated developer data after profile update; Developers are experiencing issues with updating user data in their application after a profile update. This may be caused by the app caching the request. One potential solution is to ensure that the data is updated in Appwrite before fetching it using getCurrentUser.
Axistro
29 Oct, 2024, 17:38

Did the data changed in the appwrite cloud?

NETOx
29 Oct, 2024, 17:40

Yes

Kenny
29 Oct, 2024, 17:43

IMO if the data has updated in Appwrite, but not in your app, then you're app is caching the request in some form.

Reply

Reply to this thread by joining our Discord

Reply on Discord

Need support?

Join our Discord

Get community support by joining our Discord server.

Join Discord

Get premium support

Join Appwrite Pro and get email support from our team.

Learn more