DmitrySharabin / mavo-firebase-firestore

Firebase backend plugin for Mavo. Store and sync app data in milliseconds. Store and serve files at Google scale. Authenticate users simply and securely. All the Google Firebase powers are at your fingertips.
https://plugins.mavo.io/plugin/firebase-firestore
MIT License
6 stars 0 forks source link

Bug updating mv-storage with new firebase url #15

Closed karger closed 4 years ago

karger commented 4 years ago

I've got an app that is modifying its mv-storage to change from one (firebase) url to a different one with a different collection name. This is not working. It appears this is because too little is being done on a call to update. The update method of the plugin is called (at least) whenever the mv-storage attribute changes. And the update method does parse the new url and then updates attributes of the plugin object based on it. However, the database object this.db is created only when the constructor is called, and is not updated by the update method. Thus, if the new mv-storage uses a different collection than the old one, then the database object will continue to reference the old collection so will not have the proper path for whatever new filename is being stored.

So to fix this, this.db needs to be updated if this.collection changes. And this may require other changes---for example, if a realtime snapshot listener is active on the old db, it has to be replaced with one on the new db.

DmitrySharabin commented 4 years ago

I believe this should be fixed now (in the dev version—the one in the src folder). Feel free to reopen the issue if I'm wrong.

karger commented 4 years ago

thanks dmitry.  i've modified my code to work around the issue, but i'll try to change it back later to see if it works.

On 6/16/2020 5:15 PM, Dmitry Sharabin wrote:

I believe this should be fixed now (in the dev version—the one in the |src| folder). Feel free to reopen the issue if I'm wrong.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/DmitrySharabin/mavo-firebase-firestore/issues/15#issuecomment-645016013, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIWSXVJKSYIQOGUC4TIEPTRW7OHXANCNFSM4N7VKDEQ.