Fork me on GitHub
#hoplon
<
2016-06-16
>
leontalbot00:06:25

ok, yes, I got the right version locally

jumblerg00:06:57

i think i might be on to something, one sec

leontalbot00:06:23

(page "test.html")

(html
 (head (title "Test"))
 (body (h1 "Test")))

leontalbot00:06:48

Webpage error details

User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; .NET4.0C; .NET4.0E)
Timestamp: Thu, 16 Jun 2016 00:03:32 UTC


Message: 'console' is undefined
Line: 2
Char: 79
Code: 0
URI: 

jumblerg00:06:16

try turning on advanced optimizations and see what happens

jumblerg00:06:14

so i had simple optimizations on. when opts are set to simple or advanced, it works. when they’re set to none, it fails.

leontalbot00:06:41

so even in dev mode, you use simple

leontalbot00:06:06

is it slowing you down a bit for reloads?

jumblerg00:06:23

so what is trying to access js/console that get’s shaken out when simple or advanced optimizations are on?

jumblerg00:06:48

not much… i usually have it set to none, but think it was on simple from prior testing

jumblerg00:06:27

on simple, advanced otps, correct?

jumblerg00:06:38

simple should work too

leontalbot00:06:16

excellent! Thank you so much!

jumblerg00:06:02

you’re welcome

jumblerg00:06:35

still trying to get to the bottom of why it fails with no optimizations

leontalbot00:06:11

you saw this right?

leontalbot00:06:25

if (typeof goog != "undefined") { goog.require("boot.cljs.main808"); } else { console.warn("ClojureScript could not load :main, did you forget to specify :asset-path?"); };

jumblerg00:06:01

my theory is that the console in ie 8 isn’t available unless dev tools are open or something, so it errors

jumblerg00:06:50

but that says nothing about the underlying issue of why it is trying to write this warning to the console in the first place

jumblerg00:06:42

@leontalbot: are you running on a windows machine?

leontalbot00:06:17

After my stuff works in chrome, then I should test with browserstack vms

leontalbot00:06:32

simple opts is fine

jumblerg00:06:42

yeah, i’m not going to invest too much more time on this problem… but i’d still like to understand why it is happening

jumblerg00:06:01

any insights @micha? i know very little about the boot-cljs tooling.

micha00:06:37

that happens when the js file is missing or it's trying to load it from the wrong place

micha00:06:46

and it only happens with no optimizations

jumblerg00:06:25

yeah, and only with ie 8

micha00:06:09

only with ie8?

jumblerg00:06:09

works in ten

micha00:06:26

i don't get it

micha00:06:40

how is it getting anything at /test, when the file is test.html?

jumblerg00:06:35

mine is index.html

micha00:06:48

also which boot tasks are you using

micha00:06:02

you want to remove things like reload and cljs-repl etc

jumblerg00:06:33

yeah, let me slim that pipeline down a little

leontalbot00:06:59

compojure routes

micha00:06:19

those tasks emit code for the client

micha00:06:27

which you don't want for testing like this

micha00:06:35

those tasks are just for development

micha00:06:10

compojure routes could be an issue

micha00:06:23

how do you run your server?

leontalbot00:06:27

(GET "/test" req (-> "test"
                                 response/resource-response
                                 (response/content-type "text/html")))

micha00:06:35

is that something you do separately or is it part of the browser testing thingy

micha00:06:04

yeah i don't see how that can work at all

micha00:06:07

for any browser

micha00:06:37

the resource is actually test.html from the code you pasted above

leontalbot00:06:12

(ns app.handler
  (:require
   [compojure.core                 :as c :refer [defroutes GET POST]]
   [compojure.route                :as route]
   [ring.middleware.defaults       :as d]
   [ring.util.response             :as response]   
   [castra.middleware              :as castra]
   [ring.middleware.content-type   :refer [wrap-content-type]]
   [ring.middleware.defaults       :as d]
   [ring.middleware.not-modified   :refer [wrap-not-modified]]
   [ring.middleware.resource       :refer [wrap-resource]]
   [app.routes              :as routes]
   [app.utils              :as u]))

(defroutes www

  (GET "/test" req (-> "test.html"
                       response/resource-response
                       (response/content-type "text/html")))

  (route/resources "/" {:root ""}))

(defroutes data)

(def domain-specific-routes
  (u/domain-routing
   {""        data
     ""        www
     "0.0.0.0:5000"             www
     "localhost:5000"           www}))


;;;; HANDLERS

(defn global-wrap [x]
  (-> x
      (d/wrap-defaults d/api-defaults)
      (castra/wrap-castra-session "a 16-byte secret")
      (castra/wrap-castra 'vpc-hoplon.api)))

(def dev-app (global-wrap domain-specific-routes))

(def prod-app
  (-> domain-specific-routes
      (u/wrap-force-ssl)
      global-wrap))

leontalbot00:06:40

something like that

micha00:06:27

ah ok that makes sense

jumblerg00:06:58

@micha: i cleaned up by build pipeline and it worked with no opts in ie 8

micha01:06:37

yeah those dev tasks are not expected to be used with browsers that have no useful dev tools

micha01:06:57

you'd never do that

micha01:06:12

you develop your stuff in chrome and then try to make things work in ie

jumblerg01:06:56

yeah. so, problem solved. hoplon master is supporting ie 8.

micha01:06:31

incredible! 💯

jumblerg01:06:27

glad it’s working!

leontalbot02:06:02

For some pages, I still see errors but only in IE 8... weird Message: Object doesn't support this action Line: 708 Char: 194 Code: 0 URI: https://www.votepour.ca/index.html.js

leontalbot02:06:15

IE 9 works fine everywhere

leontalbot02:06:56

here is the portion of the js code taht seems not supported

leontalbot02:06:10

null==b&&("undefined"!=typeof Object.defineProperty?(b=++Eq,Object.defineProperty(a,Gq,{value:b,enumerable:!1})):a[Gq]=b=++Eq)

jumblerg02:06:04

can you run it with no optimizations?

leontalbot02:06:04

yes, hold on

leontalbot02:06:48

the bug we have with optimization none remains on every page

ClojureScript could not load :main, did you forget to specify :asset-path?

jumblerg02:06:20

i believe this issue is caused by the dev tooling

jumblerg02:06:46

do you have tasks like cjls-repl and reload in the pipeline?

jumblerg02:06:10

my issues went away when i took these out

leontalbot02:06:11

reload yes in dev

leontalbot02:06:45

so still have the IE 8 object Object problem

jumblerg02:06:52

that was the issue i was having when running :optimizations :none

leontalbot02:06:08

this is seen with opt advanced

jumblerg02:06:34

can you create this issue with no optimizations?

leontalbot02:06:23

removing reload...

jumblerg02:06:39

also, when you say “for some pages”, can you clarify what that means?

jumblerg02:06:12

does this happen on only certain hoplon artifacts associated with the page macro?

jumblerg02:06:21

or in various views of your app?

leontalbot02:06:33

ok so even when removing reload form pipeline, still got the could not load :main issue

leontalbot02:06:43

here is my pipeline

leontalbot02:06:00

(deftask dev
  "Build vpc-hoplon for local development."
  []
  (comp
   (serve
    :port    5000
    :handler 'vpc-hoplon.server/dev-app
    :reload  true)
   (watch)
   (speak)
   (sift :move {(set->pattern excluded-files)
                  "src/vpc-hoplon/archives"})
   (hoplon)
   ;(reload) ;:on-jsload 'vpc-hoplon.rpc/refresh
   (cljs)))

jumblerg02:06:29

what server are you using?

leontalbot02:06:00

so I have in index.cljs.hl :

leontalbot02:06:21

(defn get-url-uri   [] (-> js/window .-location .-pathname))
...
(let [u (get-url-uri)]
  (case u
    "/" (view-home)
    (campaign/view-campaign (get pages u))))

leontalbot02:06:52

In IE 8, when at / I see everything. But when I am at say /test then the view-campaign doesn't load

leontalbot02:06:40

in the handler

leontalbot02:06:56

(GET "/" req (-> "index.html"
                   response/resource-response
                   (response/content-type "text/html")))
(GET "/test" req (-> "index.html"
                   response/resource-response
                   (response/content-type "text/html")))

leontalbot02:06:19

Not sure if it is comprehensive

jumblerg02:06:31

so your app works correctly in ie 8 when served from the root?

jumblerg02:06:52

with and without optimizations

leontalbot02:06:02

with opt only

jumblerg02:06:09

this has something to do with your setup, i think.

jumblerg02:06:09

i personally create my client-side hoplon artifact in a separate project from my server, and serve it statically from an s3 bucket or github

jumblerg02:06:40

my service, that produces the war file artifact, is another project

leontalbot02:06:07

And doing so would help me you think?

jumblerg02:06:28

i personally find it much cleaner and easier to reason about

jumblerg02:06:14

one project per artifact

leontalbot02:06:29

this seems really interesting

jumblerg02:06:09

you should be able to make this work, however.

jumblerg02:06:35

try moving your test app/page to the root and see if that works

leontalbot02:06:27

ok, trying...

jumblerg03:06:46

i’m stepping out for a while

leontalbot03:06:46

thanks again...

onetom04:06:13

@leontalbot: i would also argue against using the path part of the url in single page apps to determine view or screen does your SPA shows, simply because it's a lot simpler to implement that using the hash fragment part of the URL but here is an article which explains what would you need in case u insist using the path: https://kkob.us/2015/11/24/hosting-a-single-page-app-on-s3-with-proper-urls/

xificurC08:06:50

has anyone tried using hoplon with d3?

xificurC09:06:20

levitanong: cool, do you have some examples I could check?

levitanong09:06:42

@xifi: I don’t have any on-hand that I can show you (proprietary code for a client, and I would get into trouble :P) But I can come up with a quick sample later in the day for you.

levitanong09:06:53

Is there anything specific you want to see/do?

levitanong09:06:11

(my replies will be sporadic because i'm playing heroes of the storm with some friends at the moment)

xificurC09:06:24

levitanong: I haven't done much interop yet so I was just curious how well would it play with cljs. If the code would look like js in clojurescript notation or something

xificurC09:06:01

and some hoplon interop of course, how to connect the cells with the d3 data

levitanong10:06:56

@xifi: Because of d3’s nature, I approach the cell problem by do-watch.

levitanong10:06:46

(do-watch (cell= [data config])
  (fn [_ [data config]
    ;; d3 code))

xificurC11:06:51

levitanong: thanks for the snippet! I'm not familiar with do-watch, will take a look.

levitanong11:06:33

no problem. do-watch is a wrapper around add-watch. It does all the symbol generation for you. It also assumes you won’t be removing watches.

leontalbot16:06:27

@onetom: thanks! So you too are suggesting S3 hosting for hoplon spa? This cloudfront hack is good to know.

flyboarder17:06:56

@leontalbot: does your app hosting require a backend?

onetom17:06:03

@leontalbot: yes, i agree with serving the frontend of an SPA via S3+CF i just don't agree with using this 404 trick. i would just use CF to allow HTTPS & as a CDN

leontalbot17:06:41

@flyboarder currently I am using heroku to host both frontend and backend

flyboarder18:06:13

If you just need static hosting for the front end you can use firebase hosting

flyboarder18:06:32

provided your backend isn't serving the front end

leontalbot18:06:10

Yeah i got a firebase free account. Why not...

flyboarder19:06:13

@leontalbot: if you havnt already tried the new google firebase console, you should check it out

leontalbot23:06:42

@flyboarder: yeah. I saw the announcement on producthunt. Google seems serious about this!

flyboarder23:06:30

If my 2cents is worth anything, it’s pretty slick now and all the bugs i had when i first upgraded to v3 have been sorted 🙂

flyboarder23:06:56

having no backend helped accelerate our development