fix crashes on cached file from script manager

This commit is contained in:
Muki Kiboigo
2026-04-01 14:12:25 -07:00
parent 648af43f8a
commit d18acd5228

View File

@@ -273,6 +273,12 @@ pub fn addFromElement(self: *ScriptManager, comptime from_parser: bool, script_e
// Let the outer errdefer handle releasing the arena if client.request fails
}
// If we return synchronously (like from cache), we would call evaluate() immediately.
{
const was_evaluating = self.is_evaluating;
self.is_evaluating = true;
defer self.is_evaluating = was_evaluating;
try self.client.request(.{
.url = url,
.ctx = script,
@@ -290,6 +296,8 @@ pub fn addFromElement(self: *ScriptManager, comptime from_parser: bool, script_e
.done_callback = Script.doneCallback,
.error_callback = Script.errorCallback,
});
}
handover = true;
if (comptime IS_DEBUG) {