This repository has been archived by the owner. It is now read-only.

No hot swapping occurs on OS X, Linux; TypeError: undefined is not an object (evaluating 'event.time') #168

Closed
tel opened this Issue Nov 25, 2015 · 25 comments

Comments

Projects
None yet
@tel
Copy link

tel commented Nov 25, 2015

When running elm-reactor on a fresh Elm Platform install on OS X hot swapping does not occur (tested Chrome and Safari). Furthermore, when clicking the "refresh" icon I see errors like

Uncaught TypeError: Cannot read property 'time' of undefined
runtime.timer.now @ debug.js:12209
debugState.refreshScreen @ debug.js:12180
restart @ debug.js:11749
(anonymous function) @ debug.js:11629
notify @ debug.js:1225
node.notify @ debug.js:3377
broadcastToKids @ debug.js:3294
node.notify @ debug.js:3415
broadcastToKids @ debug.js:3294
node.notify @ debug.js:3317
notify @ Tut.elm?debug:1324
(anonymous function) @ debug.js:3341

The relevant line in debug.js looks like

    runtime.timer.now = function() {
        if (debugState.paused || debugState.swapInProgress)
        {
            var event = debugState.events[debugState.index];
            return event.time;
        }
        return Date.now() - debugState.totalTimeLost;
    };
@ccorcos

This comment has been minimized.

Copy link

ccorcos commented Nov 27, 2015

+1

@ronnross

This comment has been minimized.

Copy link

ronnross commented Dec 2, 2015

hot swapping doesn't work on windows as well. I'm running elm 0.16.

@thisredone

This comment has been minimized.

Copy link

thisredone commented Dec 2, 2015

Doesn't seem to work on linux also
tested on Ubuntu 15.10 (and Windows 8.1)

@maxgurewitz

This comment has been minimized.

Copy link

maxgurewitz commented Dec 3, 2015

+1

@fourcube

This comment has been minimized.

Copy link

fourcube commented Dec 7, 2015

I've investigated a little and found the following:

  1. A file system monitor is registered that watches for changes to files with a suffix of elm. It looks like the suffix has to actually contain the dot (.) so the monitoring works. This is fixed in #170 and should resolve the problem for linux users.
  2. Under OSX (10.11, ghc 7.10.2) there seems to be another problem. Data is only partially written to the client websocket connection.

When I send dummy data over the websocket in the sendHotSwapfunction

--- ... e.g.
sendHotSwap :: FilePath -> WS.Connection -> FilePath -> IO ()
sendHotSwap watchedFile connection _ =
  do  result <- liftIO (Compile.toJson watchedFile)
      _ <- WS.sendTextData connection (BSC.pack $ concat $ replicate 0xFFFF "foo")
      WS.sendTextData connection (BSC.pack result)

--- ...

, before sending the actual compiled code, everything goes through just fine. This is obviously no proper solution to the problem. I was suspecting TCP_NODELAY on this one, but it should be disabled in Snap and https://github.com/jaspervdj/websockets by default.

@chrisdwheatley

This comment has been minimized.

Copy link

chrisdwheatley commented Jan 4, 2016

Is there any update on this? I really want to show off some of the developer experience features Elm offers to some colleagues but currently can't.

@2hu12

This comment has been minimized.

Copy link

2hu12 commented Jan 5, 2016

+1

@jonathanp

This comment has been minimized.

Copy link

jonathanp commented Jan 5, 2016

I just ran into this bug as well.

@rapind

This comment has been minimized.

Copy link

rapind commented Jan 8, 2016

This is such a huge and cool feature. Can't wait to get it back! 👍

@ronnross

This comment has been minimized.

Copy link

ronnross commented Jan 10, 2016

Alright I put a call out on Elm discuss to pair with someone to fix this issue. I will definitely need some help with the Haskell part. Wish me luck in getting this working again fast.

@huiwang

This comment has been minimized.

Copy link

huiwang commented Jan 11, 2016

please fix it. it's so wanted.

@pukkamustard

This comment has been minimized.

Copy link

pukkamustard commented Jan 15, 2016

Having the same problem on OS X.

@EddyLane

This comment has been minimized.

Copy link

EddyLane commented Jan 19, 2016

+1 on OSX, would love to help but I don't think I have the chops yet, elm is on like every other podcast at the moment so it'd be great to get this working again as I think its one of the major selling points bringing new people to the language

@seanhess

This comment has been minimized.

Copy link

seanhess commented Jan 19, 2016

Sad. I'm set to present this morning on Elm. Thank you for working on the fix! @ronnross did you get the pairing help you need? If not I'd be glad to volunteer.

@ronnross

This comment has been minimized.

Copy link

ronnross commented Jan 23, 2016

@seanhess no one really volunteered to pair, but it looks like others have started working on a node port. I'm not 100% sure of the state. It lives here https://github.com/eeue56/elm-reactor/tree/node-rewrite. If you are interested in pairing up message me at http://elmlang.herokuapp.com/

@seanhess

This comment has been minimized.

Copy link

seanhess commented Jan 23, 2016

Ok, I signed up and messaged you on slack. LMK if this is worth doing. I
have next week off so I'll have plenty of time.

On Sat, Jan 23, 2016 at 9:22 AM, Ronn notifications@github.com wrote:

@seanhess https://github.com/seanhess no one really volunteered to
pair, but it looks like others have started working on a node port. I'm not
100% sure of the state. It lives here
https://github.com/eeue56/elm-reactor/tree/node-rewrite. If you are
interested in pairing up message me at http://elmlang.herokuapp.com/


Reply to this email directly or view it on GitHub
#168 (comment)
.

@dusky3

This comment has been minimized.

Copy link

dusky3 commented Jan 24, 2016

Just to let you know that hot swapping doesn't work on 64bit Void linux with Firefox as well.

@d4rkr00t

This comment has been minimized.

Copy link

d4rkr00t commented Jan 30, 2016

Hi it happens on OSX 10.11 and 10.10 with elm and elm reactor 0.16.0.

@despairblue

This comment has been minimized.

Copy link

despairblue commented Feb 26, 2016

@tel hey, could you rename the issue to make it clear that all platforms are affected? ty 🙇

@tel

This comment has been minimized.

Copy link

tel commented Feb 26, 2016

Good idea!

@tel tel changed the title No hot swapping occurs on OS X; TypeError: undefined is not an object (evaluating 'event.time') No hot swapping occurs on OS X, Linux; TypeError: undefined is not an object (evaluating 'event.time') Feb 26, 2016

@qisaw

This comment has been minimized.

Copy link

qisaw commented Mar 15, 2016

This doesn't seem to work on Windows 10 either. Any update on when this will be fixed?

@bassmake

This comment has been minimized.

Copy link

bassmake commented Apr 17, 2016

+1

@fourcube

This comment has been minimized.

Copy link

fourcube commented Apr 18, 2016

For anyone who has this problem under linux, @pgaertig posted a possible solution here:

#170 (comment)

@evancz evancz closed this May 12, 2016

@chroth7

This comment has been minimized.

Copy link

chroth7 commented May 12, 2016

Sorry to bring that up again - but in my case (using 0.17 on OSX), I still do not see any hot-swapping happening. I did read here https://groups.google.com/forum/#!topic/elm-discuss/2GzFng0utro that the time-travelling debugging is currently not possible (0.17), is that something similar here?

Thanks for a clarification (if I misunderstand, I am happy to look at my config again.

@evancz

This comment has been minimized.

Copy link
Contributor

evancz commented May 12, 2016

It's all coming back.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.