flambe icon indicating copy to clipboard operation
flambe copied to clipboard

Asset reloading incorrect after refresh in browser

Open markknol opened this issue 8 years ago • 0 comments

I observe a file using a Value<Config> and listen to file-changes to set a new Config.

    // create a config Value
    var gameConfig = getConfig("game.settings", "debug");

    // somewhere else
    function getConfig(fileName:String, assetPackName:String):Value<Config>
    {
        var file = AssetLibraryManager.getFile(fileName, assetPackName);
        inline function parseConfig() return Config.parse(file.toString());
        var value = new Value<Config>(parseConfig());
        file.reloadCount.changed.connect(function(to, from)
        {
            value._ = parseConfig();
        });
        return value;
    }

I notice when I have the asset server open, that a file gets refreshed and I get new Config with new values. This works as expected.

But it goes wrong after I refresh the browser page. Then I get old content of the file. This is weird. I checked both 'assets/debug/game.settings' folder and the build/web/assets/debug/game.settings and both contain the correct file content.

My conclusion is that the asset-server caches the file content and serves the wrong file after a file is "reloaded". Can this be the case, and is there a solution for this?

markknol avatar Oct 07 '15 13:10 markknol