Hi Felipe,
We came across into this same situation. If you use goog.string/startsWith it
will survive the optimizations.
Hope that helps,
Tom Hickey
On Wednesday, September 2, 2015 at 9:48:17 AM UTC-4, Felipe Gerard wrote:
> I have a Om contacts component that when compiled with advanced mode breaks.
>
> This is the snipet of code:
>
> (defn contatcts-comp [contacts owner]
> (reify
> om/IInitState
> (init-state [_]
> {:name-filter ""})
> om/IRenderState
> (render-state [_ {:keys [name-filter]}]
> (.log js/console "Entrando al render de contacts-comp.
> " (pr-str contacts))
> (dom/div
> nil
> (dom/table
> nil
> (dom/thead
> nil
> (dom/tr
> nil
> (dom/th
> nil
> (dom/input #js {:type "text" :placeholder
> "nombre" :value name-filter
> :onChange (fn [evt]
> (.log
> js/console (str "evt: " (.. evt -target -value)))
> (om/set-state!
> owner :name-filter (.. evt -target -value)))
> }))))
> (dom/tbody
> nil
> (om/build-all contact-comp (sort-by :name
> (filter (fn
> [p]
>
> (let [name (:name p)
>
> pattern (re-pattern (str ".*" name-filter))]
>
> ;(re-find pattern name)
>
> (.startsWith name name-filter)
>
> )) contacts))
> {:key :id})))))))
>
> If I change (.startsWith name name-filter) with (re-find pattern name) It
> works fine but when using .startsWith the production code (:advanced
> optimization) the function gets optimized AWAY and I get "Uncaught TypeError:
> a.ye is not a function"
> I have a minimal project that demonstrates the issue.
> I think this is an bug but don't know how to report it.
--
Note that posts from new members are moderated - please be patient with your
first post.
---
You received this message because you are subscribed to the Google Groups
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.