You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
user.data not updated when changing deactivated to false and setting data (formerly: observe current user not working when evaluation expired or deactivated)
#2158
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Hy
I'm observing the currentUser, to be able to notify the user inside the app, if a users evaluation or subscription expires or a subscription started.
In cases of subscription expire or starting, i use the dexieCloudRestAPI to set the "type" and so on.
This works great as long as
"type" is "prod", "valid until" is a date in the future and "deactivated" is "false" or "undefined.
or
"type" is "eval", "valid until" is a date in the future and "deactivated" is "false" or "undefined.
But when "valid until" is in the past or "deactivated" is "true"(or a date),
from then on the observer is not working anymore, because there is a HttpError: 403 with the dexieCloudAddon.
When the "type" is set back to "prod" via dexieCloudRestAPI, because the user purchased a subscription on Stripe or somewhere else,
then the app has to be restarted to connect to the cloud again.
Sometimes you also have to restart twice, to reconnect.
Is there any solution in Dexie for that usecase?
Or is my concept totally wrong?
Thanks for some answers.
The text was updated successfully, but these errors were encountered:
Yes, we are aware of this and it is according to how we have specified it: If a user has expired, it will stop connecting to the cloud unless db.cloud.sync() called explicitly by the application code.
It is recommended that the app should actively call db.cloud.sync() to refresh the license, for example as a step after a purchase flow, or allow the user to click a refresh button in the app's profile settings page where license status is visible.
Thanks, good to know.
There is just a thing.
When i set deactivated to true via restAPI: { "userId": user, "type": "eval", "deactivated": true, "data": { "RC_event": RC_event,// a nested object "test_string": "test set to deactivated", // a string } }
And then set it back to deactivated false: { "userId": user, "type": "prod", "deactivated": false, "validUntil": "2099-04-01T19:18:44+02:00", "evalDaysLeft": 0, "data": { "RC_event": RC_event, // a nested object "test_string": "test set to production", // a string } }
And then use db.cloud.sync() or restart the app, the "data" i did add to the User does not sync down to the app.
This only happens, when sync was deactivated.
When i now, while it's not deactivated, update the "data" again, it does sync.
dfahlander
changed the title
observe current user not working when evaluation expired or deactivated
user.data not updated when changing deactivated to false and setting data (formerly observe current user not working when evaluation expired or deactivated)
Apr 30, 2025
dfahlander
changed the title
user.data not updated when changing deactivated to false and setting data (formerly observe current user not working when evaluation expired or deactivated)
user.data not updated when changing deactivated to false and setting data (formerly: observe current user not working when evaluation expired or deactivated)
Apr 30, 2025
Hy
I'm observing the currentUser, to be able to notify the user inside the app, if a users evaluation or subscription expires or a subscription started.
const userObservable = dexieJS.db.cloud.currentUser
In cases of subscription expire or starting, i use the dexieCloudRestAPI to set the "type" and so on.
This works great as long as
"type" is "prod", "valid until" is a date in the future and "deactivated" is "false" or "undefined.
or
"type" is "eval", "valid until" is a date in the future and "deactivated" is "false" or "undefined.
But when "valid until" is in the past or "deactivated" is "true"(or a date),
from then on the observer is not working anymore, because there is a HttpError: 403 with the dexieCloudAddon.
When the "type" is set back to "prod" via dexieCloudRestAPI, because the user purchased a subscription on Stripe or somewhere else,
then the app has to be restarted to connect to the cloud again.
Sometimes you also have to restart twice, to reconnect.
Is there any solution in Dexie for that usecase?
Or is my concept totally wrong?
Thanks for some answers.
The text was updated successfully, but these errors were encountered: