Skip to content

Commit

Permalink
handle assigning ptr ids correctly (required for uix hydration)
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Strehle committed Oct 20, 2024
1 parent 08b3327 commit feed2a5
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion runtime/runtime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,7 @@ import { addPersistentListener, removePersistentListener } from "../utils/persis
import { endpoint_config } from "./endpoint_config.ts";
import type { DatexInData, DatexOutData } from "../network/communication-hub.ts";
import { communicationHub } from "../network/communication-hub.ts";
import { sub } from "../functions.ts";

const mime = client_type === "deno" ? (await import("https://deno.land/x/[email protected]/mod.ts")).mime : null;

Expand Down Expand Up @@ -4513,7 +4514,10 @@ export class Runtime {
let type:Type|undefined
while ((type = INNER_SCOPE.type_casts.pop())) {
// workaround to get pointer that the new cast value will be assigned to
const waitingPtr = [...INNER_SCOPE.waiting_ptrs??[]][0];
let subscopePtrs = SCOPE.sub_scopes.at(-1)?.waiting_ptrs; // INNER_SCOPE.waiting_ptrs
// workaround: only for uix - also check one subscope up for assigning pointer if none found
if (!subscopePtrs && type.name == "uix") subscopePtrs = SCOPE.sub_scopes.at(-2)?.waiting_ptrs; // go one scope up
const waitingPtr = [...subscopePtrs??[]][0];
let ptrId: string|undefined;
if (waitingPtr && (typeof waitingPtr[1] == "object" || waitingPtr[1] == undefined)) ptrId = waitingPtr[0].id;
el = await Runtime.castValue(type, el, INNER_SCOPE.ctx_intern, SCOPE.context_location, SCOPE.origin, undefined, ptrId)
Expand Down

0 comments on commit feed2a5

Please sign in to comment.