Polymerfire - how to reset firebase-document between pages?
Asked Answered
S

0

6

So, I've got a simple polymer app with a page listing some users, and a user details page.

I'm using firebase-query for the list page, and firebase-document for the details page.

I'm using app-route to pass the id of the user for the user details page

<app-route route="{{route}}" pattern="/:key" data="{{routeData}}"></app-route>
<firebase-document path="/users/[[routeData.key]]" data="{{person}}"></firebase-document>

{{person.name}}<br />
{{person.email}}<br />

So far so good, the details page reads the right document, and the data-binding works fine.

However, let's say "John" has an email, but "Bob" doesn't. If I start from the list page and click on "John", then the details page shows me the name and email for John.

Then I go back to the list page, and click on "Bob". The details page shows the name for Bob, but it shows the email for John.

In other words, if a property is empty, it will remember the one from the last person that was loaded.

How can I somehow reset everything so that I don't get values that belong to another user?

Swatow answered 5/9, 2018 at 20:32 Comment(1)
i tried to re-create this problem but it does not happening in my test app. Does your user list and user detail have different page (=element)? If so, i think you should have two <app-route> elements.Homy

© 2022 - 2024 — McMap. All rights reserved.