paf31 / purescript-purview

A UI library based on the incremental lambda calculus
MIT License
112 stars 11 forks source link

test/Main.purs doesn't seem respond to events/changes #1

Closed btrepp closed 6 years ago

btrepp commented 6 years ago

Compiled and hosted the test/Main.purs file into a simple app.

It renders correctly, but doesn't update in response to clicks. No errors are thrown in consoles, just nothing happens.

paf31 commented 6 years ago

Strange, it works for me when I use pulp test -r cat > html/index.js.

btrepp commented 6 years ago

Ah interesting, I was hoisting into into my own project using psc-package. I wonder if the package set is using a different version of a library that changes something.

I'll have a play in the purview repo and see what I can figure out.

EDIT: Looks like I had the id for "container" on the body.

<body id="container"></body>

Putting it inside another div helps

<body><div id="container"></div></body>

Though I'm not 100% sure why.

EDIT2: Using a head tag with defer works fine

<html>
    <head>
        <meta charset="utf-8">
        <script defer src="app.js"></script>
    </head>
    <body id="container"></body>
</html>

I suspect what was happening before is that

<html>
    <head>
        <meta charset="utf-8">

    </head>
    <body id="container"></body>
    <script defer src="app.js"></script>
</html>

Gets rewritten by the browser to

<html>
    <head>
        <meta charset="utf-8">
    </head>
    <body id="container">
       <script defer src="app.js"></script>
    </body>
</html>

and this breaks the render loop, as the nodes have changed outside of it's control.