                      (+ 1 max-id) )]
      (swap! app-state assoc :latest-id latest-id) ))
 
- ;; Listens for state changes in the atom and updates the map accordingly
+;; Listens for state changes in the atom and updates the map accordingly
 (add-watch app-state :map-layers-watcher
   (fn [r k old-state new-state]
     (when (not= (:map-layers old-state) (:map-layers new-state))

(defn get-layer-id! []
  (:latest-id (swap! app-state update-in [:latest-id] inc)))

;; Get n valid IDs
(defn get-new-layer-ids! [n]
  (let [id (:latest-id (swap! app-state update-in [:latest-id]  #(+ % n)))]
    (range (- id n) id) ))

(defn get-last-layer-ids [n]
  (let [id (:latest-id @app-state)]
    (range (- id n) id)))

            [clojure.data :refer [diff]]
            [reagent.core :as r]))

;; Global application state, `defonce` to persist data between updates
(defonce app-state
  (r/atom {:latest-id 0
           :add-points-qty 10
