Add keep-alive functionality by michaeltintiuc · Pull Request #18561 · ionic-team/ionic-framework · GitHub
Skip to content

Add keep-alive functionality#18561

Closed
michaeltintiuc wants to merge 6 commits into
ionic-team:masterfrom
ModusCreateOrg:router-keep-alive
Closed

Add keep-alive functionality#18561
michaeltintiuc wants to merge 6 commits into
ionic-team:masterfrom
ModusCreateOrg:router-keep-alive

Conversation

@michaeltintiuc

@michaeltintiuc michaeltintiuc commented Jun 17, 2019

Copy link
Copy Markdown
Contributor

Pull request checklist

Please check if your PR fulfills the following requirements:

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been reviewed and added / updated if needed (for bug fixes / features)
  • Build (npm run build) was run locally and any changes were pushed
  • Lint (npm run lint) has passed locally and any fixes were made for failures

Pull request type

Please check the type of change your PR introduces:

  • Bugfix
  • Feature
  • Code style update (formatting, renaming)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • Documentation content changes
  • Other (please describe):

What is the current behavior?

There is no way to cache components using ion-vue-router due limitations imposed by Vue API which state that keep-alive should be a direct child of transition when used together.

Issue Number: N/A

What is the new behavior?

Allows usage of keep-alive as a property of ion-vue-router

Basic usage:

<ion-vue-router keep-alive />

Equates to:

<keep-alive>
  <router-view />
</keep-alive>

Passing props:
<ion-vue-router :keep-alive="{ include: 'SomeComponent' }" />

Equates to:

<keep-alive include="SomeComponent">
  <router-view />
</keep-alive>

Same as the original API you can pass string, string[] or RegExp to include and exclude properties.

RegExp:
<ion-vue-router :keep-alive="{ include: /Some/ }" />

Equates to:

<keep-alive :include="/Some/">
  <router-view />
</keep-alive>

Does this introduce a breaking change?

  • Yes
  • No

@ionitron-bot ionitron-bot Bot added the package: vue @ionic/vue package label Jun 17, 2019
@Livijn

Livijn commented Jul 11, 2019

Copy link
Copy Markdown

@Livijn

Livijn commented Jul 30, 2019

Copy link
Copy Markdown

@mhartington Lets merge this, shall we?

@ggirardi1

Copy link
Copy Markdown

Is this implementation already working?

@michaeltintiuc

Copy link
Copy Markdown
Contributor Author

@guilhermeagirardi would appreciate you testing this feature here https://github.com/ModusCreateOrg/ionic-vue if building from source is a problem. Consider this PR an RFC, any feedback is highly valuable

@liamdebeasi

Copy link
Copy Markdown
Contributor

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

package: vue @ionic/vue package

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants