From e10bd6a8d311b75684dabfe789316165c5c1d4d4 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Tue, 7 Apr 2026 16:34:08 +0200 Subject: [PATCH] :bug: Fix infinite recursion in get-frame-ids for thumbnail extraction (#8807) The get-frame-ids function could enter infinite recursion when: 1. There's a circular reference in the frame hierarchy 2. A shape's frame-id points to itself (corrupt data) The fix uses the cached version (get-frame-ids-cached) in recursive calls and adds a guard to prevent self-referencing. --- .../src/app/main/data/workspace/thumbnails.cljs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/frontend/src/app/main/data/workspace/thumbnails.cljs b/frontend/src/app/main/data/workspace/thumbnails.cljs index f2d23e06b5..85e8ecef8d 100644 --- a/frontend/src/app/main/data/workspace/thumbnails.cljs +++ b/frontend/src/app/main/data/workspace/thumbnails.cljs @@ -228,25 +228,25 @@ instance-root? (conj ["component" id]))] - (swap! frame-id-cache assoc id {:status :in-progress - :result local-result}) + (swap! frame-id-cache assoc id local-result) (let [result (cond-> local-result (and (uuid? (:frame-id old-shape)) - (not= uuid/zero (:frame-id old-shape))) + (not= uuid/zero (:frame-id old-shape)) + (not= id (:frame-id old-shape))) (into (get-frame-ids-cached (:frame-id old-shape))) (and (uuid? (:frame-id new-shape)) - (not= uuid/zero (:frame-id new-shape))) + (not= uuid/zero (:frame-id new-shape)) + (not= id (:frame-id new-shape))) (into (get-frame-ids-cached (:frame-id new-shape))))] - (swap! frame-id-cache assoc id {:status :done - :result result}) + (swap! frame-id-cache assoc id result) result))) (get-frame-ids-cached [id] - (if-let [cached (get @frame-id-cache id)] - (:result cached) + (if (contains? @frame-id-cache id) + (get @frame-id-cache id) (get-frame-ids id)))] (into #{} (comp (mapcat extract-ids)