-
Notifications
You must be signed in to change notification settings - Fork 142
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
Cloud Firestore Support #278
base: master
Are you sure you want to change the base?
Conversation
Ok will work on it this coming week :) |
@stemuk sorry, was just finished doing an event last weekend and was just finishing some backlogs I accumulated. Will work on this once I am free (hopefully this weekend) |
@tjmonsi there are couple of issues I'd like to work on, especially:
I'd like to avoid wasting my or your's time on fixing the same issues twice, shall we split these ones or do you have sth else in mind to work on over the weekend? |
@merlinnot I am still doing some backlogs so please do whatever you can. I think I am going to merge someone else's PR to the firestore branch. If it's alright, can you create an issue about the bugs that you have stated so that it's connected to the PR that you will merge to this. My plans for this one is review the current version on how it plays with firestore and create a behavior for backwards comp, and elements firestore-query and firestore-document (still deciding). I would be changing the name of this one as well to be firestore-mixin so that it is more appropriate. Hopefully I can merge them all by the end of next week. |
@tjmonsi for use of firestore within a dom-repeat I think the only possible way with a mixin is to use a dom-module inside the dom-repeat. With firebase-document it'll be possible to fetch a document directly inside each template. |
At the moment the firestore-mixin is a one-way-binding with firestore. Is it for firestore technically also possible to implement two-way-binding (just like firebase-document)? |
@arcodebonte It is technically possible, but it is generally discouraged to do so. It's a nice feature to show off, but it's most often an anti-pattern. |
@merlinnot thanks for setting up the issues :) |
@merlinnot thanks for your response! Nice to hear that also the two-way-binding is possible. I agree that this binding must be used thoughful. |
@arcodebonte Let us see what's the best way to do it. |
File demo/firestore-element-demo.html contained only one demo, for collections. New component was created for document demo. Filenames and component names were renamed accordingly.
…oreMixin It simplifies the syntax. Functions where converted to lambdas assigned to constants to avoid polluting inherited context.
On two-way binding -- I'm pretty against it, honestly. Firestore charges
based on doc reads and doc writes, whereas the Realtime Database charged
only based on transferred bandwidth. So updating one field at a time wasn't
a big deal in RTDB, but is in Firestore as you're triggering multiple
writes.
I'd be more interested in seeing demos of, for example, a "debounced save"
where changes are tracked and persisted after 500ms of inactivity, for
example.
…On Fri, Oct 20, 2017 at 2:29 AM Toni-Jan Keith Monserrat < ***@***.***> wrote:
@arcodebonte <https://github.com/arcodebonte> Let us see what's the best
way to do it.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#278 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAAD_ncQiKPRd_s7TM2z7jeQTOAQ0GtLks5suGf2gaJpZM4PxKeQ>
.
|
Rename FirestoreElement to FirestoreMixin
So there's good news and bad news. 👍 The good news is that everyone that needs to sign a CLA (the pull request submitter and all commit authors) have done so. Everything is all good there. 😕 The bad news is that it appears that one or more commits were authored by someone other than the pull request submitter. We need to confirm that they're okay with their commits being contributed to this project. Please have them confirm that here in the pull request. Note to project maintainer: This is a terminal state, meaning the |
@mbleigh I see your point as well. The auto 2-way binding will have bad consequences on every minuscule update. I also like your idea about a debounce of 500ms but I don't know 500ms enough. That would mean every short type burst of here and there would still create a significant number of writes instead of one good write. It might take like a really complicated solution (like caching all edits first and then until a threshold has been reached (either by time that is longer or a change in location, then it auto-saves... but that's also too general) |
…names containing special characters.
Firestore: add document demo, fix property bindings
Currently, when one document in a collection changes, an entirely new array is assigned to a property. It does not work well with dom-repeats, iron-lists etc. This change lays the groundwork for a more efficient solution.
Fixes an issue with `query` parameter being read from the constructor of an element instead of collecting the correct one from the prototype chain in FirestoreMixin.
Any chance we'll see a merge/release on these features sometime soon? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Jep Bug will be fixed if code will be changed to this: https://cl.ly/220W2O0r1U0A
firebase-firestore-mixin.html
Outdated
super.connectedCallback(); | ||
} | ||
|
||
_firestoreBind(type, path, name, live = false, observes = []) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't here the query missing.
Shouldn't it, so it's available in this line 194.
I looked through the code because I was wondering why queries are never called and realised that query is never assigned to the config.
Is this a correct discovery?
Would love to see this fixed if so.
:)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@merlinnot Is there a version which fixes this issue and can be used for internal tools?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@IchordeDionysos Not really. I've made quite a few PRs to fix various issues in a Firestore mixin, but repo owners are really unresponsive 😢 Take a look at #274.
…d in FirestoreMixin.
…n FirestoreMixin.
Multiple fixes and improvements to the FirestoreMixin
Fix `super.connectedCallback` invocation in FirestoreMixin
@tjmonsi Did you progress on this thoughts? @merlinnot
https://firebase.google.com/docs/firestore/manage-data/add-data#add_a_document |
Hi @derhuebiii, welcome onboard, nice to see someone interested in this PR :) There is actually some support for this. Given
a property named async addSomeStuffToTheCollection() {
return this.somePropRef.add({someStuff: true});
} Both docs and collections have these properties, the |
Thanks @merlinnot ! I will play around with this. Also thanks for creating this branch! Might make sense to add this to the documentation. I am not so familiar with participating on github but after playing around, I might try to suggest some edit. |
Actually it's not me who created this branch, it's @mbleigh. Documentatio is a part of this PR, see https://github.com/firebase/polymerfire/pull/278/files#diff-ed26b76bc80e40b84633288e109db714R90 |
Fix persistence issue with documents, introduce noCache option, improve docs
this._firestoreUnlisten(name); | ||
|
||
const config = this._firestoreProps[name]; | ||
const isDefined = (x) => x !== undefined; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question here around whether the mixin should defensively prevent the binding of the DB when propArgs[n] === ''
as well as when propArgs[n] === undefined
? Theoretically it can be programmed around, and it publishes a clear error up the line, but it seems like here's a pretty solid place to prevent complaints, as well as make possible some potentially useful patterns.
The mixin doesn't seem to work with IE11 - just get a blank page when using mixin with latest version of Polymer Starter Kit and using |
Has there been any progress on this front? I'm looking into adding firestore support to an existing Polymer app and would greatly prefer to use a polymerfire solution rather than roll my own or use a less well supported resource. |
I'm finishing it up soon. You can see the progress here: #346 |
All right, I've done the initial import of my experimental Cloud Firestore work. I also added an
analysis.json
as per the new rules for makingiron-component-page
work (not sure if that's the right way to go). Docs should show up properly on webcomponents.org, so that's nice.@tjmonsi this is probably as far as I'm going to have time to take this in the immediate future. I'd be grateful for your help fleshing it out further.
Todo
Fixes #274