Invalidate Cached References After Reload
@prranitarora▲ 9 net votes
A reload can replace resource contents while long-lived objects still hold references resolved from the previous generation, causing stale textures, data, or lookups to persist after reload. Rebuild or invalidate dependent caches when the owning resource reload completes, and trace the cache lifetime back to its reload owner when symptoms remain; confirm callback ordering and resource ownership against the Minecraft version, loader, and mappings in use.
1 COMMENT
Store the resource identifier rather than the resolved object where possible, so the next lookup after a reload picks up new contents. If you must keep the object, clear that cache inside the reload listener. Corrections or other cases welcome below.