Replies: 1 comment 1 reply
-
Non deterministic behavior smells like ambiguous system ordering. A couple things to try in no particular order
Edit: Consider filing a bug with a minimal repro? |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I have a custom asset loader that parses an XML file. It creates multiple labeled assets, one for each element that has an "id" attribute. However I'm having a problem where some of the assets get prematurely unloaded.
Here's the scenario: I call server.load() to get an asset. I store the resulting handle into a component. Once I get an event that says that the asset is loaded, I call server.load() again to get a secondary asset (basically a stylesheet for the element) in the same file. I then store that handle into a different component. I have an asset event listener set up to listen for when the secondary asset is loaded.
What happens next is non-deterministic: sometimes it works, but mostly not. When it works, I get an event saying that the secondary asset is loaded. When it doesn't work, I get an "AssetEvent::Removed" event for the secondary asset, even though it was never loaded - that is, I never got an
AssetEvent::Created
orAssetEvent::Modified
event for the secondary asset. Pollingserver.get_load_state()
for the secondary asset returnsUnloaded
even though it was never loaded.What's even more strange is that if I touch the asset file (hit save in VSCode), everything suddenly magically works - the secondary asset gets reloaded, I get the loaded event, and the polling loop sees that the asset is indeed loaded.
Am I doing something terribly wrong, or is this an actual bug? I've spent like two days on this :(
Beta Was this translation helpful? Give feedback.
All reactions