diff --git a/frontend/src/app/main/ui/workspace/context_menu.cljs b/frontend/src/app/main/ui/workspace/context_menu.cljs index dfae97b10..1557f0abe 100644 --- a/frontend/src/app/main/ui/workspace/context_menu.cljs +++ b/frontend/src/app/main/ui/workspace/context_menu.cljs @@ -461,6 +461,8 @@ is-dangling? (nil? (if local-component? (ctkl/get-component workspace-data component-id) (ctf/get-component workspace-libraries component-file component-id))) + lib-exists? (and (not local-component?) + (some? (get workspace-libraries component-file))) do-add-component #(st/emit! (dwl/add-component)) do-add-multiple-components #(st/emit! (dwl/add-multiple-components)) @@ -568,7 +570,7 @@ (when can-update-main? [:& menu-entry {:title (tr "workspace.shape.menu.reset-overrides") :on-click do-reset-component}]) - (when components-v2 + (when (and components-v2 lib-exists?) [:& menu-entry {:title (tr "workspace.shape.menu.restore-main") :on-click do-restore-component}])] [:* diff --git a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs index e31d76543..8aa7743b3 100644 --- a/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs +++ b/frontend/src/app/main/ui/workspace/sidebar/options/menus/component.cljs @@ -167,6 +167,9 @@ (ctkl/get-component workspace-data component-id) (ctf/get-component workspace-libraries library-id component-id)) is-dangling? (nil? component) + lib-exists? (and (not local-component?) + (some? (get workspace-libraries library-id))) + on-menu-click (mf/use-callback @@ -251,7 +254,7 @@ [[(tr "workspace.shape.menu.detach-instance") do-detach-component] (when can-update-main? [(tr "workspace.shape.menu.reset-overrides") do-reset-component]) - (when components-v2 + (when (and components-v2 lib-exists?) [(tr "workspace.shape.menu.restore-main") do-restore-component])] [[(tr "workspace.shape.menu.detach-instance") do-detach-component] (when can-update-main?