Continuing with salvage

There appears to be bitrot in the JavaScript dependencies; specifically in how secretary is doing routing. I have NOT got to the bottom of this.
This commit is contained in:
Simon Brooke 2022-06-16 19:30:00 +01:00
parent f93a0e854a
commit 0ebbc71d5c
No known key found for this signature in database
GPG key ID: A7A4F18D1D4DF987
5 changed files with 36 additions and 18 deletions

View file

@ -45,9 +45,10 @@ Consequently, to get a build running:
1. clone the repository, if you have not already done so; 1. clone the repository, if you have not already done so;
2. within your cloned repository, check out a branch (usually `develop` or `master`); 2. within your cloned repository, check out a branch (usually `develop` or `master`);
3. if you have previously built the project within your cloned repository, run `lein clean`; 3. if you have previously built the project within your cloned repository, run `lein clean`;
4. **this is the important bit** run `lein adl` to generate much of the application code; 4. run `lein npm install`;
5. run `lein run` to start your development server; 5. **this is the important bit** run `lein adl` to generate much of the application code;
6. if you want to do client debugging, you'll want to run `figwheel` in a separate process, but also from the same cloned repository directory; I normally do this by opening a second terminal and invoking `lein figwheel`. 6. run `lein run` to start your development server;
7. if you want to do client debugging, you'll want to run `figwheel` in a separate process, but also from the same cloned repository directory; I normally do this by opening a second terminal and invoking `lein figwheel`.
## Further Reading ## Further Reading

View file

@ -16,6 +16,8 @@
;; [cljsjs/react-leaflet "1.6.5-0"] ;; [cljsjs/react-leaflet "1.6.5-0"]
;; [cljsjs/react-leaflet "2.4.0-0"] is available but doesn't seem to work fully ;; [cljsjs/react-leaflet "2.4.0-0"] is available but doesn't seem to work fully
[cljsjs/leaflet "1.5.1-0"] ;; leaflet-reagent-reframe uses this and it works with Firefox! [cljsjs/leaflet "1.5.1-0"] ;; leaflet-reagent-reframe uses this and it works with Firefox!
[cljsjs/react "16.11.0-0"]
[cljsjs/react-dom "16.11.0-0"]
[cljs-ajax "0.8.0"] [cljs-ajax "0.8.0"]
[com.andrewmcveigh/cljs-time "0.5.2"] [com.andrewmcveigh/cljs-time "0.5.2"]
[clojure.java-time "0.3.2"] [clojure.java-time "0.3.2"]
@ -46,15 +48,15 @@
[org.webjars/font-awesome "5.11.2"] [org.webjars/font-awesome "5.11.2"]
[org.webjars.bower/tether "1.4.4"] [org.webjars.bower/tether "1.4.4"]
[postgre-types "0.0.4"] [postgre-types "0.0.4"]
[re-frame "0.10.9"] [re-frame "1.2.0"]
[reagent "0.8.1"] [reagent "1.1.1"]
[reagent-utils "0.3.3"] [reagent-utils "0.3.4"]
[recalcitrant "0.1.2"] [recalcitrant "0.1.2"]
[ring-middleware-format "0.7.4"] [ring-middleware-format "0.7.4"]
[ring/ring-defaults "0.3.2"] [ring/ring-defaults "0.3.2"]
[ring/ring-servlet "1.7.1"] [ring/ring-servlet "1.7.1"]
[ring-webjars "0.2.0"] [ring-webjars "0.2.0"]
[secretary "1.2.3"] [clj-commons/secretary "1.2.4"]
[selmer "1.12.40"]] [selmer "1.12.40"]]
:deploy-repositories [["releases" :clojars] :deploy-repositories [["releases" :clojars]
@ -95,7 +97,8 @@
:npm {:dependencies [[datatables.net "1.10.19"] :npm {:dependencies [[datatables.net "1.10.19"]
[datatables.net-dt "1.10.19"] [datatables.net-dt "1.10.19"]
[jquery "3.3.1"] [jquery "3.3.1"]
[leaflet "1.3.1"] ;; [leaflet "1.3.1"]
;; [react "18.2.0"]
[selectize "0.12.6"] [selectize "0.12.6"]
[signature_pad "2.3.2"] [signature_pad "2.3.2"]
[simplemde "1.11.2"]] [simplemde "1.11.2"]]

View file

@ -44,7 +44,11 @@
<!-- scripts and styles --> <!-- scripts and styles -->
<!-- Leaflet --> <!-- Leaflet -->
<link rel="stylesheet" href="js/lib/node_modules/leaflet/dist/leaflet.css" /> <link rel="stylesheet" href="js/lib/node_modules/leaflet/dist/leaflet.css" />
<script src="js/lib/node_modules/leaflet/dist/leaflet.js"></script> <!-- script src="js/lib/node_modules/leaflet/dist/leaflet.js"></script -->
<!-- TEMP: react seems no longer to be automatically added to the dependencies by reagent? -->
<!-- script src="js/lib/node_modules/react/index.js"></script -->
<!-- Signature pad --> <!-- Signature pad -->
<script src="js/lib/node_modules/signature_pad/dist/signature_pad.min.js"></script> <script src="js/lib/node_modules/signature_pad/dist/signature_pad.min.js"></script>
<!-- our actual app --> <!-- our actual app -->

View file

@ -200,12 +200,20 @@
(defn hook-browser-navigation! (defn hook-browser-navigation!
"Interceptor for the browser back button." "Interceptor for the browser back button."
[] []
(try
(js/console.log "Entering `hook-browser-navigation!`")
(doto (History.) (doto (History.)
(events/listen (events/listen
HistoryEventType/NAVIGATE HistoryEventType/NAVIGATE
(fn [event] (fn [event]
(secretary/dispatch! (.-token event)))) (js/console.log "Entering anonymous history update handler")
(.setEnabled true))) (try
(secretary/dispatch! (.-token event))
(catch js/Error e (js/console.warn e)))
(js/console.log "Exiting anonymous history update handler")))
(.setEnabled true))
(catch js/Error e (js/console.warn e)))
(js/console.log "Exiting `hook-browser-navigation!`"))
;; ------------------------- ;; -------------------------
;; Initialize app ;; Initialize app
@ -224,6 +232,7 @@
(rf/dispatch [:fetch-followupmethods]) (rf/dispatch [:fetch-followupmethods])
;; (rf/dispatch [:dispatch-later [{:ms 60000 :dispatch [:process-queue]}]]) ;; (rf/dispatch [:dispatch-later [{:ms 60000 :dispatch [:process-queue]}]])
(load-interceptors!) (load-interceptors!)
;; TEMP: the browser navigation hook is breaking the loading of the building page, and I don't at this moment understand why.
(hook-browser-navigation!) (hook-browser-navigation!)
(mount-components)) (mount-components))

View file

@ -99,8 +99,9 @@
;; (dispatch [:set-zoom (.getZoom view)]) ;; (dispatch [:set-zoom (.getZoom view)])
;; (dispatch [:set-latitude (.-lat centre)]) ;; (dispatch [:set-latitude (.-lat centre)])
;; (dispatch [:set-longitude (.-lng centre)])) ;; (dispatch [:set-longitude (.-lng centre)]))
(js/console.log (str "Navigating to " "#building/" id)) (js/console.log (str "Navigating to " "#/building/" id))
(set! window.location.href (str "#building/" id)) ;; (set! window.location.href (str "#/building/" id))
(dispatch [:set-address 262])
) )