mirror of
https://github.com/penpot/penpot.git
synced 2025-02-13 10:38:13 -05:00
🐛 Fix unexpected exception on viewer caused by nil objects
This issue is started to happening because of an unrelated change on frame-shape react component where shapes are looked up directly on objects having in supposition that objects will be exists but on viewer there are two objects: fixed and not-fixed, and in some cases objects map can be empty or don't contain the object. For solve the issue, we just filter not existing objects before progragate the children down to the inner react components, avoiding the exception when an object appears as `nil`.
This commit is contained in:
parent
9e07999537
commit
df2d242746
1 changed files with 12 additions and 12 deletions
|
@ -7,6 +7,7 @@
|
|||
(ns app.main.ui.viewer.shapes
|
||||
"The main container for a frame in viewer mode"
|
||||
(:require
|
||||
[app.common.data :as d]
|
||||
[app.common.geom.shapes :as gsh]
|
||||
[app.common.pages.helpers :as cph]
|
||||
[app.common.types.shape.interactions :as ctsi]
|
||||
|
@ -381,19 +382,18 @@
|
|||
(defn frame-container-factory
|
||||
[objects all-objects]
|
||||
(let [shape-container (shape-container-factory objects all-objects)
|
||||
frame-wrapper (frame-wrapper shape-container)]
|
||||
frame-wrapper (frame-wrapper shape-container)
|
||||
lookup-xf (keep (d/getf objects))]
|
||||
(mf/fnc frame-container
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [shape (obj/get props "shape")
|
||||
childs (mapv #(get objects %) (:shapes shape))
|
||||
props (obj/merge! #js {} props
|
||||
#js {:shape shape
|
||||
:childs childs
|
||||
:objects objects
|
||||
:all-objects all-objects})]
|
||||
|
||||
[:> frame-wrapper props]))))
|
||||
{::mf/wrap-props false}
|
||||
[props]
|
||||
(let [shape (unchecked-get props "shape")
|
||||
childs (into [] lookup-xf (:shapes shape))
|
||||
props (obj/merge props
|
||||
#js {:childs childs
|
||||
:objects objects
|
||||
:all-objects all-objects})]
|
||||
[:> frame-wrapper props]))))
|
||||
|
||||
(defn group-container-factory
|
||||
[objects all-objects]
|
||||
|
|
Loading…
Add table
Reference in a new issue