I am trying to create a simple dynamic svg. One where the viewbox settings update with change in the window dimensions.
To do this I have a top level component defined as follows
(defn windowdim_comp
[]
(with-let [wndcomp_state (atom {:text "Parent2Component"})
resize_handler #(swap! wndcomp_state assoc
:height (.-innerHeight js/window)
:width (.-innerWidth js/window))
mousemove_handler #(swap! wndcomp_state assoc
:x (.-pageX %)
:y (.-pageY %))
_ (.addEventListener js/window "resize" resize_handler)
_ (.addEventListener js/document "mousemove" mousemove_handler)
_ (swap! wndcomp_state assoc :height (.-innerHeight js/window))
_ (swap! wndcomp_state assoc :width (.-innerWidth js/window))]
[:div
[:p "width : " (:width @wndcomp_state) " height : " (:height @wndcomp_state)]
[:p "x : " (:x @wndcomp_state) " y : " (:y @wndcomp_state)]
(svgrender (cursor wndcomp_state [:text :width :height]))
]
(finally
(.removeEventListener js/window "resize" resize_handler)
(.removeEventListener js/document "mousemove" mousemove_handler))))
This component then calls a child component called svgrender with a cursor taking just the :text :width & :height values... defined as follows:
(defn svgrender
[parent_state]
(with-let [svgstate (atom {:clicked false})
mousedown_handler #(swap! svgstate assoc
:clicked true)
mouseup_handler #(swap! svgstate assoc
:clicked false)]
[:svg {:viewBox "0 0 500 500"
:width 500
:height 500
:id "svgcontainer"
:onMouseDown mousedown_handler
:onMouseUp mouseup_handler}
[:g {:id "layer1"}
[:rect {:id "rect1"
:width 500
:height 500
:x 0
:y 0
:style {:fill (if (:clicked @svgstate)
"#ff00ff"
"#00ffff")}}]
[:text {:x 5
:y 15
:class "small"}
(gstring/format "width : %s height : %s" (:width @parent_state) (:height @parent_state))]
[:text {:x 5
:y 35
:class "small"}
(gstring/format "Click status : %s" (:clicked @svgstate))]
[:text {:x 5
:y 55
:class "small"}
"Parent Text: " (:text @parent_state)]]]
(finally
(.removeEventListener (.getElementById js/document "svgcontainer")
"onmousedown" mousedown_handler)
(.removeEventListener (.getElementById js/document "svgcontainer")
"onmouseup" mouseup_handler))))
The the problem is no matter what I do, I can't get the values from the parent_state to display in the child node.... they just display as nulls

Please can someone help me? I don't know what I am doing wrong!!
UPDATE: As per suggestion from Walton I've come up with a few variations
Parens call to component with full parent state passed
(svgrender wndcomp_state)
Result : Fail
Parens call to component with cursor like in the original code
(svgrender (cursor wndcomp_state [:text :width :height]))
Result : Fail
Parens call to component with track as per Walton's suggestion
(svgrender (track #(select-keys @wndcomp_state [:text :width :height])))
Result : Pass!!
Square call to component with full parent state passed
[svgrender wndcomp_state]
Result : Pass!!
Square call to component with cursor like in the original code
[svgrender (cursor wndcomp_state [:text :width :height])]
Result : Fail
Square call to component with track as per Walton's suggestion
[svgrender (track #(select-keys @wndcomp_state [:text :width :height]))]
Result : Pass!!
Now this is so bizzare.... no? While I accept Walton's answer, can anyone explain why this is the case?