-
Notifications
You must be signed in to change notification settings - Fork 72
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.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to set up a "read-only" firebase-document (or, "read-first") #120
Comments
Bump for some action... |
@mm-gmbd Hi! |
In the process up putting together a repro now... thanks for the attention, @cdata! |
@cdata @mm-gmbd This doesn't exactly reproduce the scenario described above but it is related. I added the code to my github (link below) which includes a fairly detailed description of the issue. https://github.com/brogers4/firebase-test |
Here's a JSBin reproduction: |
Any update? We weren't able to reproduce the error where the same location is referenced multiple times (still exploring it though). It looks like at least part of the original bug was due to putting the |
@cdata, Yes, I am collaborating with @mm-gmbd (he is on vacation which is why I am now responding). I was trying to reproduce the error described originally; however, I now think the description as to the potential cause of the error originally proposed by @mm-gmbd to be incorrect (though, we are still debating). Our original thought was that since the What we did discover is that the error originally encountered by @mm-gmbd occurred not because it was lazily loaded in a second tab, but because it was lazily loaded inside a dom-repeat template. The GitHub repro describes the error in detail, but basically the |
I'm building a single page application that has two tabs. A
firebase-document
to a particular location is called by an element on the first tab. The second tab is lazily loaded, and afirebase-document
to the same location is set up by an element in that second tab.The user only has read privileges to this location, but I'm getting the following error when the second
firebase-document
is loaded:This is because the
data
attribute that is supplied to the second Firebase document isnull
because I am awaiting the value to be supplied by thefirebase-document
. Instead, it immediately updates the local cache (I think) tonull
, which is why I think the error is happening (as it calls_dataChanged
).I'd like a way to instantiate multiple
firebase-document
's that reference the same location without this happening. I had hoped to do this by binding the data from thefirebase-document
in such a way that it is child-to-host, but that requires the child element (in this case,firebase-document
) to have thereadOnly
property set to true fordata
.A potential solution is to include a "readOnly" property to the
firebase-document
itself, that, if set to true, would set thereadOnly
property ofdata
to true, which would then allow for child-to-host data binding. Another solution would be to include areadFirst
tofirebase-document
property which would read the data if it was in the local Firebase cache, if it wasn't in the Firebase cache, it would attempt to update the remote document.Otherwise, I'm forced to load the data at location only once and then pass it around through Polymer variables (which is not going to happen because I am uncertain of how nested these elements may be), or through something like
akc-meta
, which I'd rather not use.Thoughts?
The text was updated successfully, but these errors were encountered: