Skip to content

Commit

Permalink
Reval sheet on rename frame
Browse files Browse the repository at this point in the history
  • Loading branch information
prabhanshuguptagit committed Jun 29, 2024
1 parent fdf315f commit e2e3cc9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
8 changes: 8 additions & 0 deletions src/bean/grid.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,14 @@
(eval-sheet-a-few-times sheet*)
sheet))

(defn rename-frame [sheet old-name new-name]
(if-let [frame (get-in sheet [:frames old-name])]
(-> sheet
(update :frames dissoc old-name)
(assoc-in [:frames new-name] frame)
eval-sheet-a-few-times)
sheet))

(defn clear-area [sheet {:keys [start end]}]
(->> (util/addresses-matrix start end)
(mapcat identity)
Expand Down
5 changes: 1 addition & 4 deletions src/bean/ui/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -277,10 +277,7 @@
::rename-frame
(undoable)
(fn edit-frame [db [_ old-name new-name]]
(let [frame (get-in (:sheet db) [:frames old-name])]
(-> db
(update-in [:sheet :frames] dissoc old-name)
(assoc-in [:sheet :frames new-name] frame)))))
(update db :sheet #(grid/rename-frame % old-name new-name))))

(rf/reg-event-db
::add-labels
Expand Down

0 comments on commit e2e3cc9

Please sign in to comment.