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

Race condition between view HTML importing and view-model attaching #25

Closed
6 tasks done
tomalec opened this issue Mar 9, 2017 · 8 comments
Closed
6 tasks done
Assignees
Labels

Comments

@tomalec
Copy link
Contributor

tomalec commented Mar 9, 2017

Steps to reproduce

  1. Use <starcounter-include view-model="{{something}}">.
  2. Change something to a new partial view model with new HTML and new data.

Live Demo

https://jsbin.com/ligimo/3/edit?html,output

Expected result

  1. Markup should be loaded, then
  2. New model should be attached to it.

Actual result

  1. Markup is requested
  2. New model is attached to the old markup
  3. Error is throws:
    Invalid value used as weak map key
    
  4. New markup is loaded
  5. New model is attached to new markup

Browsers affected

  • Chrome
  • Firefox
  • Edge
  • Safari 9
  • Safari 8
  • IE 11

Screenshot

2017-03-07 01_10_15-polymer-mini html c__program files_starcounter_clientfiles atom

2017-03-07 01_10_44-locationapp

Related

https://github.com/RemoteCloud/SystemLocationApp/issues/8
Juicy/imported-template#24
Juicy/juicy-html#10
possibly Juicy/imported-template#26 (comment)

@tomalec
Copy link
Contributor Author

tomalec commented Mar 9, 2017

Comment by @tomalec moved from https://github.com/RemoteCloud/SystemLocationApp/issues/8#issuecomment-285033549

@warpech This is something with imported-template (and juicy-html) we need to discuss, as the flow looks as follows

  1. Server responds with {op: 'replace', path: '/path/CurrentPage', value: {Html: 'new/url.html', data: {newdata:"smth"}.
  2. Entire binding chain, synchronously sets both attributes, on imported-template: content and model.
  3. imported-template synchronously, sends asynchronous request for new markup, and
  4. synchronously sets new model to (old) markup.

I see few solutions:

  1. starcounter-include should wait with attaching model until, new content is effectively loaded.
  2. imported-template should detach markup when new markup is requested.
  3. imported-template should block attaching new model when request is pending.

Related issues:
Juicy/imported-template#24
Juicy/juicy-html#10

@tomalec
Copy link
Contributor Author

tomalec commented Mar 9, 2017

Comment by @warpech moved from https://github.com/RemoteCloud/SystemLocationApp/issues/8#issuecomment-285341750

We discussed with @tomalec that solution 1. is the most elegant one.

@tomalec tomalec self-assigned this Mar 9, 2017
@jwillmer
Copy link

Any progress?

@tomalec
Copy link
Contributor Author

tomalec commented Mar 22, 2017

Should be done today EOD

@tomalec
Copy link
Contributor Author

tomalec commented Mar 23, 2017

Sorry for the delay, I have to redesign and rewrite all the tests. Hopefully, one day more would be enough.

@jwillmer
Copy link

Sorry for the delay, I have to redesign and rewrite all the tests. Hopefully, one day more would be enough.

Is it?

tomalec added a commit that referenced this issue Mar 28, 2017
@tomalec
Copy link
Contributor Author

tomalec commented Mar 29, 2017

Sorry I was delayed by some other issues. PR with the fix is already waiting for the review.

@tomalec
Copy link
Contributor Author

tomalec commented Mar 29, 2017

New build available at http://downloads.starcounter.com/download/Starcounter/RC/2.3.0.6170

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants