Heavy caching while developing


#1

I’m experiencing heavy cahching issues while working on a tablet app + QML. The way I solved it using HTML was by adding a random query script to the HTML path, ex: “ui.html?randomstring”.

But it doesn’t work with QML, the only way to update the changes is by restarting the HF interface. Any solutions?


#2

I only know that i hate the caching and curse jt with everything in high fidelity. It’s terrible for developing.

Yiu can do a clear cache in developer menu. but then it’s reloading everythjng. makes you not happy to.


#3

Normally with JS that you can just load the scripts straight from your filesystem which don’t get cached, which is how I develop everything before to pushing to a server, @Richardus.Raymaker

The only tricky part is the creation of the paths to the files.

Same thing applies for any models or textures loaded directly from filesystem, but that is equally tricky with the paths.

Now some info: OverlayWindow basically is always a QML Window while OverlayWebWindow is a Extension of a QML Window Tablet app uses either, depending on what the file name ends with.

QML apps are loaded and compiled into memory when loaded and a context is created for that file. JS/HTML apps are wrapped in a QML Shell by default, but this allows them to be loaded via cache busters.

IIRC: You’ll need to destroy the instance first prior to creating it again to reload it. So alternatively either clear cache or restart the client for now.

Unfortunately I havent played around with it much, so I dont know the script interfaces for it, so I usually stick with HTML/JS due to the above. there used to be a way to do it without the above.


#4

Correct, that os how i worked to with scripts.
It only does not work for loaded objects or compounds or if you need to reload a script inside entity. Some have a reload button. others am not sure if it’s improved.


#5

QML coder here!

Yeah, QML caching is weird, but tamable. Any resources called within any script will need to be cache busted, but reloading the source script doesn’t require itself to be cache busted (weird, I know). You can, however, still get the same benefit of cache busting for QML:

var uiQml = Script.resolvePath("tablet-browser-b20170911-2209.qml?"+Math.random());

As for internal QML stuff, I’m not sure if it works the same. There are a few odd quirks I’ve had to deal with on web based QML (QML uploaded to HTTP) like icon sourcing:

ToolButton {
    id: backButton
    Image {
        id: backImg
        anchors.fill: parent
        anchors.margins: 2
        source: Qt.resolvedUrl('back-button.svg');
    }
    iconSource: backImg
    //text: 'Back'
    onClicked: {
        loaderItem.goBack();
    }
}

Hopefully this provides some insight on how to resolve the issue. I’m pretty sure using a Math.random() on Qt.resolvedUrl should also work about the same… if that it will also create a cache the size of mountains just to resolve the quirks themselves.

Cheers!


#6

I used your ‘? + Math.random’ trick with HTML and that works, but it doesn’t seem to work with QML. Reloading a script should definitely clear scripts cache.