Clear page data / app data on logout

I’m having trouble when a user logs out, and another user logs in, in the same browser, the second user sees the previous user’s information. I think it’s because it is in page/app data. What is the correct way to destroy page/app data on logout?


Hi Tim,

You could either delete specific properties in page/app data using the Delete Object Property block or initialize them (page/app data) to a brand new object without any properties.


Hi Mark,

I’m already doing the first approach, but clearly, I am missing something, so I wanted to clean everything out fully.


Would you mind explaining how I would initialize them (page/app data) as a new object? That’s the part I couldn’t figure out that prompted this post.


Looks like there is no block to reset an object, however, the following function will do it for you:
UI Builder - ConsoleDemo - Backendless 2022-08-17 12-40-41

I was just setting the value to “”, which I thought was enough. Thank you for spelling it out for me, seeing your function makes it so obvious :man_facepalming:

Thanks, @mark-piller!

1 Like

Hey @mark-piller,

I’m having an issue with the logic you proposed. When my logout code (shown above) runs, I get all these errors -

I think it’s because the rest of the page is still “running” and now is throwing errors when the values they depended on were deleted. That is a total guess, this one has me stuck. If that’s correct, what is the solution?


In what event handler do you perform this operation?

On click from the navigation component -

Looks like a better place to do it would be in the authLogin page. Set a flag here to indicate that the properties should be deleted and when you arrive to authLogin perform the clean-up there.

I can do that. One more question, authLogin can have query string variables, which if I remember correctly, get added directly to Page Data. How would you suggest removing everything from Page Data when new variables I need are getting set?

Now that I’m writing this out, do I need to delete everything from page data? That should be all lost when going to another page, right?


When you navigate to a new page, PageData will contain only the data that was past to it from the previous page.

When you say “past to it”, do you mean in here -


Yes. The data connector expects an object. The object is then merged with the PageData object on the visited page.

Thanks, @mark-piller