Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Duplicate elements on page using wf:insert_top / wf:insert_bottom in event(init) #62

Closed
m-2k opened this issue May 8, 2014 · 3 comments

Comments

@m-2k
Copy link
Contributor

m-2k commented May 8, 2014

In the browser creates two copies using functions to add items to the DOM.

True for the function wf:insert_top/2 and wf:insert_bottom/2 inside event(init):

%% table.erl
event(init) ->
    wf:insert(test,#span{body= wf:f("~p", [erlang:now()])}).
<!-- table.html template-->
<div id="test"></div>
%% routes.erl
route(<<"/table">>) -> table;
route(<<"/ws/table">>) -> table;

event-init

@5HT
Copy link
Member

5HT commented May 8, 2014

In n2o_sample we have wf:insert_top and it works ok.

event(init) ->
    User = wf:user(),
    wf:reg(room),
    X = wf:qs(<<"x">>),
    wf:insert_top(history,
        #panel{id=banner, body=
            [#span{id=text, body = wf:f("User ~s logged in. X = ~p", [User,X]) },
             #button{id=logout, body="Logout", postback=logout},
             #br{}]}),
    wf:insert_top(history,"-1-");

@m-2k
Copy link
Contributor Author

m-2k commented May 8, 2014

the second element appears after about a second

2014-05-09 1 21 59

@5HT
Copy link
Member

5HT commented May 8, 2014

You really have clean build? I can't reproduce it.

@5HT 5HT closed this as completed in c57e01a May 8, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants