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

iron-localstorage-load event is not fired when local storage is set in an async callback. #56

Open
johnlim opened this issue Jul 10, 2017 · 0 comments

Comments

@johnlim
Copy link

johnlim commented Jul 10, 2017

Description

iron-localstorage-load event is not fired when local storage is set in an async callback.

Expected outcome

iron-localstorage-load should be fired whenever local storage is set

Actual outcome

iron-localstorage-load event is never fired if localstorage is initially empty

Live Demo

https://github.com/johnlim/polymer-starter-kit/tree/ironLocalStorageIssue

Steps to reproduce

  1. Download the repo and checkout the branch ironLocalStorageIssue
  2. Run bower install
  3. Run polymer serve
  4. Open a browser tab in Chrome and open dev tools
  5. Go to Application tab in dev tools and clear the local storage
  6. Go to dev console and refresh the browser.
  7. the expected console message ******received iron-localstorage-load event***** is not printed
  8. Go to the source code, element-parent.html and comment out line 21 and 23 (i.e. remove the async call)
  9. Repeat steps 4 - 6.
  10. the console message ******received iron-localstorage-load event***** is printed in the console.

Please note that the async call in ready function is just to duplicate the issue encountered and not an actual use case. In my actual use case, I have an ajax call, that when successful, triggers a callback that sets the local storage.

Browsers Affected

  • [* ] Chrome
  • [ *] Firefox
  • [ *] Safari 10
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

1 participant