Back

[SOLVED] documentlist is empty after logging out and immediatly logging back in.

  • 1
  • Databases
  • Flutter
  • Cloud
IrateB
29 May, 2023, 20:42

Hello, I'm currently developing an Flutter app where the User has a corresponding Member collection, with the User id as an attribute of that collection.

When I start my application and there is an active session, the correct document is fetched from the dtb.

However, when I logout the User with deleteSession and log back in the same User (or another user) with createEmailSession the same function returns an empty documentlist. There are no AppwriteExceptions thrown.

If I restart my debugging session/application the document is fetched correctly from the dtb.

I already debugged everything step by step, everything works correct, the session is deleted, the session is created and because I'm using Futures, the database fetch is only executed after the session was back created.

I'm using the package appwrite 9.0.0 in combination with stacked 3.3.0 as framework.

I have the idea this is a caching issue on the device, this based on the fact that the sessions are created on "android browser on android 13" and I have no clue how to clear the cache from code.

Does anyone have an idea of what can be my issue or how I can approach this?

Thanks in advance,

B

TL;DR
The user is experiencing an issue where the document list is empty after logging out and immediately logging back in. They have tried disposing services and creating new instances, but it did not solve the problem. Another suggestion was to use state management to handle the authentication function and clear the controller when logging out. The user suspects it may be a caching issue on the device. The issue was eventually solved by adding read permissions for guests. The user is still unsure if there will be consequences when updating data later on. If more information is needed, they request to be contacted as they are unable to solve the issue at the moment.
medamine
29 May, 2023, 21:39

You need to use a state management to handle the Auth function and when you logout you need to clear the controller,when you creat a session again initialize the controller again

IrateB
31 May, 2023, 16:03

Hi, thank you for your answer. I dispose both services (account & database) and create a new instance of the service each time it is requested from the dependency injector. Still no avail.

IrateB
31 May, 2023, 17:42

If more information is requested, please contact me, I'm not able to solve the issue at the moment.

IrateB
31 May, 2023, 18:09

Solved, I had to add the read permissions for guests. No idea why, but that is working. I will still need to find out if this has consequences when the User wants to update his data later on.

IrateB
31 May, 2023, 18:09

[SOLVED] documentlist is empty after logging out and immediatly logging back in.

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