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

feat(router): stateful routes #538

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open

Conversation

jwx
Copy link
Member

@jwx jwx commented Oct 17, 2017

Adds stateful routes so that route configurations can specify a module or a module in a viewport as stateful: true. A stateful module that's loaded in a viewport is never unloaded when navigating away, it's just not shown, and is displayed with the same state whenever a route places it in the same viewport again.

Depending on #536, #538, aurelia/templating#572, aurelia/templating-router#64 and aurelia/templating-router#65.
Closes #534.

@jwx jwx force-pushed the stateful-viewports branch from 37bf152 to 87b6aa3 Compare October 19, 2017 23:15
jwx added a commit to jwx/templating-router that referenced this pull request Oct 20, 2017
Adds stateful routes so that route configurations can specify a module or a module in a viewport as `stateful: true`. A stateful module that's loaded in a viewport is never unloaded when navigating away, it's just not shown, and is displayed with the same state whenever a route places it in the same viewport again.

Required by aurelia/router#538.
Closes aurelia/router#534.
@EisenbergEffect
Copy link
Contributor

@davismj This is a pretty highly requested feature. The PR has quite a few changes, so needs careful review.

@davismj
Copy link
Member

davismj commented Dec 10, 2017

@EisenbergEffect I thought I had replied to this one. What does this solve that a @singleton view model doesn't?

@davismj davismj self-assigned this Dec 11, 2017
@oneillci
Copy link

@davismj @jwx Can I ask what's the status of this pull request? This looks like a feature that would be very useful for my application

@davismj
Copy link
Member

davismj commented Jan 11, 2018

@oneillci I need a bit of time to review this. I'll keep this on my radar for an April release.

@jfstephe
Copy link

@jwx - Can I just check something? If I had a route:

person/:id/details

and I navigated through 100 people, it would have 100 hidden people waiting in the DOM(view)/in-memory(view model). Is this correct?

By 'hidden' do you mean 'display:none' in css or removed from the DOM?

Apart from increase memory demands are there any drawbacks of this feature?

Do you still get the same 'activate' etc events in the 'detail' VM?

Is there a way to clear the cache, if you so wanted?

@TonyLugg
Copy link

TonyLugg commented Jul 7, 2018

Was this ever implemented? I am building an app that has a geographic map and I want the map to be retained in memory when I navigate away and return.

@EisenbergEffect
Copy link
Contributor

@davismj After addressing the current round of router issues, it would be great if you could review this. This is a very long standing request and this PR has been sitting here for over 6 months.

@TonyLugg
Copy link

And this one too please :)
#528

@davismj
Copy link
Member

davismj commented Jul 17, 2018

@TonyLugg #528 is next on my queue.

Adds stateful routes so that route configurations can specify a module or a module in a viewport as `stateful: true`. A stateful module that's loaded in a viewport is never unloaded when navigating away, it's just not shown, and is displayed with the same state whenever a route places it in the same viewport again.

Depending on aurelia/templating-router#64 and aurelia#536.
Closes aurelia#534.
@jwx jwx force-pushed the stateful-viewports branch from 87b6aa3 to 76e0f91 Compare September 19, 2018 14:04
jwx added a commit to jwx/templating-router that referenced this pull request Sep 19, 2018
Adds stateful routes so that route configurations can specify a module or a module in a viewport as `stateful: true`. A stateful module that's loaded in a viewport is never unloaded when navigating away, it's just not shown, and is displayed with the same state whenever a route places it in the same viewport again.

Required by aurelia/router#538.
Closes aurelia/router#534.
@oising
Copy link

oising commented Sep 19, 2018

Bump.

@jfstephe
Copy link

@davismj @EisenbergEffect - any news on this? Any eta?

@jfstephe
Copy link

jfstephe commented Mar 23, 2020

@jwx @davismj @EisenbergEffect - any news on this? Any eta? If there's anything I can do to help with this please let me know! Would be good to know what's stopping this from being merged (apart form the conflicts) as considering using this branch in production....

@fkleuver
Copy link
Member

Apologies for keeping everyone waiting on this for so long.

At the moment our priority is with getting Aurelia 2 to alpha. That is not to say that we're abandoning v1, but I strongly believe it to be in the majority of the community's best interest that we first get v2 to a state where we can comfortably recommend it for production, before adding any new features to v1.

This feature as well as almost all other requested features are in fact already implemented and well-tested in v2. The bulk of the remaining work in v2 is further improving test coverage, and maximizing backwards compatibility with v1 to ease migration.

The original plan was to get v2 done in Q1 this year. Due to various circumstances we won't make that, so we're trying to make sure it will at least be Q2 at the latest, and to maximize the odds of accomplishing that we need to focus all effort on v2 for the time being. After that, the idea is to circle back to v1 and backport some tests and features where possible, bringing v1 and v2 closer to each other to make migration even easier.

@jfstephe
Copy link

@fkleuver - many thanks for the detailed reply, Looking forward to v2! :-)

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

Successfully merging this pull request may close these issues.

Feature query: stateful routes (module + viewport)
8 participants