Coder Social home page Coder Social logo

lazy-pages's People

Contributors

atotic avatar maximermilov avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

lazy-pages's Issues

Can't set page to the same page (but with new content)

I have an issue where I need to refresh a lazy-page with new content, but I also want the page transition as if it were a new page. Currently there is code to prevent this which I have not been able to get around without forking.

I don't want to have new elements for every page since they all share the same type of element and the pages are dynamic and I am using routing.

My current work around is to set the page to a 'blank' element, then quickly set the page back to the original page (inside a timeout). This mostly works, but it isn't great. I'd be grateful you could tell me a better way or if you could add support for this. Thanks.

Failing for two quick consequent transitions and back

We are experiencing the following behavior:

When "navigating" through two transitions of templates (either by clicking / tapping, or by pushing browser history) and navigating then back, the transition mechanism fails.

I am not 100% sure of the following, but this is our hypothesis what is going on.

Let us assume that transitions are from template A to template B and teamplate B to template C and back from teamplate C to template B.

B and C are not instanced templates yet.

The first transition starts, sets B template 'if' property to true. No instance is 'materialized' yet.
The second transition immediatelly cancels the first transition. Wants to start from B, but still hasn't instance of template B. B does not get handled correctly somehow in the cleanup, C is displayed though. But navigating (any time later) back from C to B fails.

This is the current entry page activation.

    // start entryPage activation
    this.lazy._setSelectedItem(this.entryPage);
    if (this.isTemplate(this.entryPage)) {
      this.entryPage.addEventListener('dom-change', this._boundDomChange);
      if (this.entryPage.if)
        console.warn('transitioning to already showing template');
      this.entryPage.if = true; // generate the dom
    }
    ...

On transitioning back from C to B, the entryPage (template B) has the "if" property stil set to true, the 'dom-change' is not fired, the _boundDomChange() method is not called.

We would suggest this change as an 'optimistic' approach to always fire the transition:

    // start entryPage activation
    this.lazy._setSelectedItem(this.entryPage);
    if (this.isTemplate(this.entryPage)) {
      if (this.entryPage.if) {
        console.warn('transitioning to already showing template');
        this._boundDomChange();
      }
      else {
        this.entryPage.addEventListener('dom-change', this._boundDomChange);
        this.entryPage.if = true; // generate the dom
      }
    }

This works for us.

Might need correct handling of stopped transition "not yet materialized" pages though.

It doesn't work with dom-repeat

<lazy-pages
   animate-initial-selection
        attr-for-selected="route"
        selected="{{chapterIndex}}"
        rescue-selection="0">

          <template is="dom-repeat" items="[[activity.chapters]]">

            <template is="dom-if" route="[[index]]">

It always returns lazy-pages.html:354 rescueSelection page not found

NO LONGER MAINTAINED

I no longer code in Polymer, so I can't maintain this repo. Pull requests still accepted.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.