Giter VIP home page Giter VIP logo

Comments (11)

morphy2k avatar morphy2k commented on July 29, 2024 1

This is the normal behavior AFAIK. New versions are loaded only after a cold start.

if (remoteVersion != object.version) {
// If true, download new image for next load
await this.upsertRemoteFileToCache(object, image.maxSizeBytes);
}

I suspect because of the RAM cache, which is renewed only with a restart.

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

But does shouldCache:false not make sure to force a new read of the image and not use the cache ?

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

How can I make sure to get the latest uploadet image I just updated or created from Firestore when I read it again the first time ?
Please be aware that I use the same name every time. Fx. "profileimage.jpg"
But I gues you compare with metadata create/update date so I should get the latest image. But this is not what is happening. I only get the old image.. ?

from firebase_image.

mattreid1 avatar mattreid1 commented on July 29, 2024

Firebase does not allow for us to listen to changes in a bucket in the same way we can for Realtime Database or Firestore. As such, the code will manually check the metadata for changes whenever the widget is rendered.

If you're bucket changes are somehow linked to Firestore (e.g. image upload triggers a Cloud Function then the Cloud Function updates Firestore), then you could write some code that listens for changes in Firestore and re-render the widget whenever there is an update.

Hope this clears things up!

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

Thanks, but I actually DO re-render the widget but still get the old image from cache and not the newest. Is there a way to force a get of the newest image and not use cache locally ? I tried "shouldCache:false" - but it gives me old cache image, not the image that is actually stored online?

from firebase_image.

jbryanh avatar jbryanh commented on July 29, 2024

I'm trying to work through this as well. A cold restart is required to update the image. @janlektonen, i'd love to hear if you found a workaround. @mattreid1, the image is not seeming to evaluate on widget rendering. It only seems to be evaluating on start up. I'm referring to iOS btw.

I have tried snuffing the tempDirectory/firebase_image , all kinds of work arounds, and I can't seem to come up with a good solution to get FirebaseImage to refresh on widget rebuild when the storage image changes. It just won't do it. It seems to be that it's on a timer of sorts...but maybe this is coming from the iOS RAM as @morphy2k said? But If you can't over-ride it by completely deleting its temp directory, as I tried, what solution is there?

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

@jbryanh, I haven't found a workaround for this. I think it could be that the newest flutter-package update from firebase might have influenced the way this package reads and handles cache from Firebase? But i'm just guessing.

I would be nice if the "shouldCache:false" just does what it is supposed to do when updating state on the widget.

@mattreid1, My solution to developer: If you reload/update state on the widget and "shouldCache" is set to false, then the image should reload from Firestore no matter what and bypass cache completely and reload image again over network from Firestore.

So I'm hoping that it will be fixed soon, please ;-)

from firebase_image.

jbryanh avatar jbryanh commented on July 29, 2024

Seems to me the issues would be related. Whether shouldCache is set to false or not, on widget reload, the image should update if the image at Storage has changed, which it does not. For now, I've had to just drop the plugin so that images will refresh properly. Would sure rather use the plugin though. It's a very helpful plugin, and a huge thanks to @mattreid1 for developing it. I couldn't unwind what was keeping it from replacing the cache image myself, so I sure won't criticize.

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

Yes, it does not work, just testet it again if it would refresh new images. But still shows old from cache, even though I force it to download with shouldCache: false.

@mattreid1 I hope you can have a look at it and see why it does not refresh when metadate change in firebase storage ?

from firebase_image.

janlektonen avatar janlektonen commented on July 29, 2024

This is the normal behavior AFAIK. New versions are loaded only after a cold start.

if (remoteVersion != object.version) {
// If true, download new image for next load
await this.upsertRemoteFileToCache(object, image.maxSizeBytes);
}

I suspect because of the RAM cache, which is renewed only with a restart.

@mattreid1 Would there be a working solution around this to get it working without a restart?

from firebase_image.

jbryanh avatar jbryanh commented on July 29, 2024

I think these cache plugins are GREAT if you just need static images loaded at start up that aren't dynamic or won't change in that session. I had to drop the plugin and use firebase to record the createdTimes...firebase became my repository of MetaData for images instead of Storage. That way I can compare and reload images whenever I want during widget rebuilds. Feels wonky still, but I just don't want a unique metadata read on every widget build, and I can piggyback the meta info in existing firebase docs i'm already streaming.

from firebase_image.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.