sveltefire icon indicating copy to clipboard operation
sveltefire copied to clipboard

Any plans for lower-level helpers / documentation?

Open hdoro opened this issue 5 years ago • 2 comments

Hey there, Jeff! First of all, thank you a ton for this library, it's really amazing how fast you can build with it 🎉🎉

Overall, I feel like sveltefire's structure is great for common use cases, but it lacks a bit when it comes to custom stuff, which leave us facing the following decision quite often:

"Should I use component X or roll my own functions?"

There's the UploadTask example, which will re-upload the file every time the component using it re-renders.

Another big one is accessing what data changed between snapshots with Collection: you can access the data through let:data or on:data, as well as the ref, but it's impossible to use Firebase's methods for checking changes as collectionStore only exposes data.

I haven't had much experience with sveltefire (or firebase and the most complex parts of svelte, for that matter) to see if there are workarounds, but I can tell it isn't clear at first. As this library is its infancy, I'd like to propose the creation of lower level helpers and documentation that allow for high customization but don't require as much set-up on our end.

For Collections, dispatching snapshot changes would already do the trick, as I'd simply add a on:snapshot handler. For UploadTask, I'm not sure having a component is necessarily the way to go for most people, and updatePhotoUpload is probably enough for all use cases, so it'd boil down to better documentation and use cases (which you're aware, just reinforcing this haha).

Let me know if you agree, I can make a couple PRs based on your directions 😉

Again, awesome library that puts together an awesome framework and an awesome service, thanks for that 🔥🔥🔥

hdoro avatar Jan 14 '20 22:01 hdoro

Thank you for the input @hcavalieri 👍 I see what you mean about exposing the snapshot on the store, and it would be nice to have an event for that - maybe they could share the same event since data is based off the snapshot.

codediodeio avatar Feb 26 '20 19:02 codediodeio

Not sure I follow, details are already blurry... But yeah, exposing the snapshot is nice and isn't any leap from what's already in place, as for the implementation I'll leave that to you :)

Thank you for your time as always!

hdoro avatar Feb 27 '20 21:02 hdoro