Skip to content

Commit

Permalink
Fixes exception on refresh when in external window
Browse files Browse the repository at this point in the history
Fixes #234 and potentially #209.
  • Loading branch information
superstructor committed Sep 11, 2019
1 parent fc7839d commit 0930090
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/day8/re_frame_10x/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,13 @@
(str "width=" width ",height=" height ",left=" left ",top=" top
",resizable=yes,scrollbars=yes,status=no,directories=no,toolbar=no,menubar=no"))]
(let [d (.-document w)]
(when-let [el (.getElementById d "--re-frame-10x--")]
(r/unmount-component-at-node el))
;; We had to comment out the following unmountComponentAtNode as it causes a React exception we assume
;; because React says el is not a root container that it knows about.
;; In theory by not freeing up the resources associated with this container (e.g. event handlers) we may be
;; creating memory leaks. However with observation of the heap in developer tools we cannot see any significant
;; unbounded growth in memory usage.
;(when-let [el (.getElementById d "--re-frame-10x--")]
; (r/unmount-component-at-node el)))
(.open d)
(.write d new-window-html)
(goog.object/set w "onload" #(mount w d))
Expand Down

0 comments on commit 0930090

Please sign in to comment.