简体   繁体   English

带有 shadow-cljs 的 react-leaflet 的错误不明确

[英]Unclear error from react-leaflet with shadow-cljs

I'm getting this error message when I compile code for production and deploy to server but not getting it locally.当我为生产编译代码并部署到服务器但没有在本地获取它时,我收到此错误消息。 I'm stumped as to why I can't re-produce locally我很困惑为什么我不能在本地重新生产

Uncaught TypeError: Cannot read properties of undefined (reading 'replace')
    at E (tabbed-dataview.js:2526)
    at M.getTileUrl (tabbed-dataview.js:2749)
    at M.createTile (tabbed-dataview.js:2748)
    at M._addTile (tabbed-dataview.js:2744)
    at M._update (tabbed-dataview.js:2741)
    at M._setView (tabbed-dataview.js:2737)
    at M._resetView (tabbed-dataview.js:2736)
    at M.onAdd (tabbed-dataview.js:2727)
    at M._layerAdd (tabbed-dataview.js:2655)
    at M.whenReady (tabbed-dataview.js:2615)

Here's how the code looks like下面是代码的样子


(defn map-component
  [selected-tileset]
  (let [all-geofields @(re-frame/subscribe [::subs/geofields])
        selected-geofield @(re-frame/subscribe
                             [::subs/selected-geofield-or-all])
        all-selected? (= :all (:name selected-geofield))
        geojson @(re-frame/subscribe [::subs/geojson])
        leaflet-map (useMap)]
    (js/console.log "x" (clj->js geojson))
    (js/console.log "y" (clj->js leaflet-map))
    (when (seq (:features geojson))
      (let [geo-json (geoJson (clj->js geojson))]
        (js/console.log "z" (clj->js leaflet-map))
        (try (.fitBounds leaflet-map (.getBounds geo-json))
             (catch js/Error e (js/console.log e))))
      [:<> [field-toggle] [layer-chooser] [:> TileLayer selected-tileset]
       [:> ZoomControl {:position "bottomleft"}]
       (if all-selected?
         (map (fn [geofield] [feature-group geofield]) all-geofields)
         [feature-group selected-geofield])])))

(defn map-page
  []
  (let [selected-tileset @(re-frame/subscribe
                            [::subs/selected-tileset-or-default])
        geojson @(re-frame/subscribe [::subs/geojson])]
    (if geojson
      [:div.map-page.tab-page {:key (:url selected-tileset)}
       [:> MapContainer {:zoomControl false}
        [:f> map-component selected-tileset]]]
      [loading-spinner-component])))

似乎selected-tileset为零,这就是导致此错误的原因... getTileUrl应该是一个线索(不知道为什么我看不到它)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM