Skip to content

Updates to caching article for app.lifecycle APIs #12565

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

Open
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

JoshuaPartlow
Copy link
Contributor

Updates article to reflect changes API changes for app caching.

Article is being staged to fascilitate technical review, do not merge.

@acrolinxatmsft1
Copy link
Collaborator

Acrolinx Scorecards

We currently enforce a minimum score of 80.

Click the scorecard links for each article to review the Acrolinx feedback on grammar, spelling, punctuation, writing style, and terminology:

Article Score Issues Scorecard Processed
msteams-platform/tabs/how-to/app-caching.md 82 43 link

More info about Acrolinx

Use the Acrolinx extension, or sidebar, in Visual Studio Code to check spelling, grammar, style, tone, clarity, and key terminology when you're creating or updating content. For more information, see Use the Visual Studio Code extension to run Acrolinx locally.

Copy link
Contributor

Learn Build status updates of commit 98ed438:

⚠️ Validation status: warnings

File Status Preview URL Details
msteams-platform/tabs/how-to/app-caching.md ⚠️Warning View Details
msteams-platform/assets/images/saas-offer/cached-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/saas-offer/first-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/tabs/first-launch-app.png ✅Succeeded View
msteams-platform/assets/images/tabs/suspended-launch-app.png ✅Succeeded View

msteams-platform/tabs/how-to/app-caching.md

  • Line 138, Column 4: [Warning: bookmark-not-found - See documentation] Cannot find bookmark '#enable-app-caching' in 'tabs/how-to/app-caching.md'.

For more details, please refer to the build report.

Note: Your PR may contain errors or warnings or suggestions unrelated to the files you changed. This happens when external dependencies like GitHub alias, Microsoft alias, cross repo links are updated. Please use these instructions to resolve them.

For any questions, please:

@acrolinxatmsft1
Copy link
Collaborator

Acrolinx Scorecards

We currently enforce a minimum score of 80.

Click the scorecard links for each article to review the Acrolinx feedback on grammar, spelling, punctuation, writing style, and terminology:

Article Score Issues Scorecard Processed
msteams-platform/tabs/how-to/app-caching.md 82 43 link

More info about Acrolinx

Use the Acrolinx extension, or sidebar, in Visual Studio Code to check spelling, grammar, style, tone, clarity, and key terminology when you're creating or updating content. For more information, see Use the Visual Studio Code extension to run Acrolinx locally.

Copy link
Contributor

Learn Build status updates of commit c648891:

✅ Validation status: passed

File Status Preview URL Details
msteams-platform/assets/images/saas-offer/cached-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/saas-offer/first-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/tabs/first-launch-app.png ✅Succeeded View
msteams-platform/assets/images/tabs/suspended-launch-app.png ✅Succeeded View
msteams-platform/tabs/how-to/app-caching.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:


* Follow the guidelines in this section to onboard your app to app caching in Teams meeting. For app caching support only in meetings, register the `load` or `beforeUnload` handlers if the context is `sidePanel`.
* App suspension isn't supported for the meeting stage or dialog (referred as task module in TeamsJS v1.x) contexts, because these can be opened on top of the tab and the same iframe or webview can't be used to render the content in the tab and the dialog.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The table in the beginning of the doc shows what frameContext Teams support for caching.
For non-Teams hubs, only FrameContext.Content will be cached. That means, FrameContext.Task that is inside Dialog in not supported.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lakhveerk Added the below entry with the following text, could you let me know if it looks ok?

The table in the introductory section, App suspension for your tab app, provides information about what frameContext Teams supports for caching. For non-Teams hubs, only FrameContext.Content is cached. That means, FrameContext.Task, which is inside Dialog is not supported.

@acrolinx-at-msft2
Copy link
Collaborator

Acrolinx Scorecards

We currently enforce a minimum score of 80.

Click the scorecard links for each article to review the Acrolinx feedback on grammar, spelling, punctuation, writing style, and terminology:

Article Score Issues Scorecard Processed
msteams-platform/tabs/how-to/app-caching.md 81 45 link

More info about Acrolinx

Use the Acrolinx extension, or sidebar, in Visual Studio Code to check spelling, grammar, style, tone, clarity, and key terminology when you're creating or updating content. For more information, see Use the Visual Studio Code extension to run Acrolinx locally.

Copy link
Contributor

Learn Build status updates of commit 989c8eb:

✅ Validation status: passed

File Status Preview URL Details
msteams-platform/assets/images/saas-offer/cached-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/saas-offer/first-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/tabs/first-launch-app.png ✅Succeeded View
msteams-platform/assets/images/tabs/suspended-launch-app.png ✅Succeeded View
msteams-platform/tabs/how-to/app-caching.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@acrolinx-at-msft2
Copy link
Collaborator

Acrolinx Scorecards

We currently enforce a minimum score of 80.

Click the scorecard links for each article to review the Acrolinx feedback on grammar, spelling, punctuation, writing style, and terminology:

Article Score Issues Scorecard Processed
msteams-platform/tabs/how-to/app-caching.md 92 21 link

More info about Acrolinx

Use the Acrolinx extension, or sidebar, in Visual Studio Code to check spelling, grammar, style, tone, clarity, and key terminology when you're creating or updating content. For more information, see Use the Visual Studio Code extension to run Acrolinx locally.

Copy link
Contributor

Learn Build status updates of commit 9c58f04:

✅ Validation status: passed

File Status Preview URL Details
msteams-platform/assets/images/saas-offer/cached-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/saas-offer/first-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/tabs/first-launch-app.png ✅Succeeded View
msteams-platform/assets/images/tabs/suspended-launch-app.png ✅Succeeded View
msteams-platform/tabs/how-to/app-caching.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@acrolinxatmsft1
Copy link
Collaborator

Acrolinx Scorecards

We currently enforce a minimum score of 80.

Click the scorecard links for each article to review the Acrolinx feedback on grammar, spelling, punctuation, writing style, and terminology:

Article Score Issues Scorecard Processed
msteams-platform/tabs/how-to/app-caching.md 92 20 link

More info about Acrolinx

Use the Acrolinx extension, or sidebar, in Visual Studio Code to check spelling, grammar, style, tone, clarity, and key terminology when you're creating or updating content. For more information, see Use the Visual Studio Code extension to run Acrolinx locally.

Copy link
Contributor

Learn Build status updates of commit 0a031c6:

✅ Validation status: passed

File Status Preview URL Details
msteams-platform/assets/images/saas-offer/cached-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/saas-offer/first-launch-app.png ✅Succeeded n/a (file deleted or renamed)
msteams-platform/assets/images/tabs/first-launch-app.png ✅Succeeded View
msteams-platform/assets/images/tabs/suspended-launch-app.png ✅Succeeded View
msteams-platform/tabs/how-to/app-caching.md ✅Succeeded View

For more details, please refer to the build report.

For any questions, please:

@JoshuaPartlow JoshuaPartlow marked this pull request as ready for review May 13, 2025 21:38
@v-srmurugan v-srmurugan requested a review from v-preethah June 5, 2025 11:20

App caching improves subsequent launch time of the apps within Teams by allowing you to keep some resources and assets in memory that you can use when rehydrating your app.
When a user navigates away from an app, the app can either be suspended or terminated. Suspension means that the app is sitting in the background and isn't visible to the user. Termination means that the app is completely closed and removed from memory. Suspending an app improves subsequent launch time of the apps within Teams, or other Microsoft 365 products, by allowing you to keep some resources and assets in memory that you can use when you rehydrate your app.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When a user navigates away from an app, the app can either be suspended or terminated. Suspension means that the app is sitting in the background and isn't visible to the user. Termination means that the app is completely closed and removed from memory. Suspending an app improves subsequent launch time of the apps within Teams, or other Microsoft 365 products, by allowing you to keep some resources and assets in memory that you can use when you rehydrate your app.
When a user navigates away from an app, the app can either be suspended or terminated. Suspension means the app functional in the background and isn't visible to the user. Termination means the app is completely closed and removed from memory. Suspending an app improves subsequent launch time of the apps within Teams, or other Microsoft 365 products, by allowing you to keep some resources and assets in memory that you can use when you rehydrate your app.


To enable app suspension, follow the steps:

1. Call [app.lifeCycle.registerBeforeSuspendOrTerminate](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registerbeforesuspendorterminatehandler) and [app.lifeCycle.registerOnResumeHandler](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registeronresumehandler) APIs. These handlers are required to enable app suspension. Additional information about the [lifecycle module](/javascript/api/@microsoft/teams-js/app.lifecycle) is available in the TeamsJS reference.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
1. Call [app.lifeCycle.registerBeforeSuspendOrTerminate](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registerbeforesuspendorterminatehandler) and [app.lifeCycle.registerOnResumeHandler](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registeronresumehandler) APIs. These handlers are required to enable app suspension. Additional information about the [lifecycle module](/javascript/api/@microsoft/teams-js/app.lifecycle) is available in the TeamsJS reference.
1. Call [app.lifeCycle.registerBeforeSuspendOrTerminate](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registerbeforesuspendorterminatehandler) and [app.lifeCycle.registerOnResumeHandler](/javascript/api/@microsoft/teams-js/app.lifecycle#@microsoft-teams-js-app-lifecycle-registeronresumehandler) APIs. These handlers are required to enable app suspension. For more information, see the [lifecycle module](/javascript/api/@microsoft/teams-js/app.lifecycle) available in the TeamsJS reference.

```

> [!NOTE]
> Previously APIs in the `teamsCore` module were used to enable app caching. If an app registers for both `app.lifecycle` and `teamsCore` pairs of handlers, the `app.lifecycle` handlers overwrite the `teamsCore` handlers.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
> Previously APIs in the `teamsCore` module were used to enable app caching. If an app registers for both `app.lifecycle` and `teamsCore` pairs of handlers, the `app.lifecycle` handlers overwrite the `teamsCore` handlers.
> Previously, APIs in the `teamsCore` module were used to enable app caching. If an app registers for both `app.lifecycle` and `teamsCore` pairs of handlers, the `app.lifecycle` handlers overwrite the `teamsCore` handlers.

@@ -128,67 +150,74 @@ To enable precaching for your tab app, follow these steps:
}
```

> [!NOTE]
> [!
]
> * The `contentUrl` can't contain context-specific parameters, such as team site URL or thread ID, as Teams loads apps with no prior context during launch.
> * The `contentUrl` must be generic enough to load in the background without any user interaction.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note

  • The contentUrl can't contain context-specific parameters, such as team site URL or thread ID, as Teams loads apps with no prior context during launch.
  • The contentUrl must be generic enough to load in the background without any user interaction.


* Apps need to re-register for events such as `themeChange`, `focusEnter`, and so on, in the load handler. Teams client won't send any notifications to the app when cached. If your app requires notifications even when cached, caching might not be the right solution.
* The suspended app can be used within the same window. The app that is suspended in a pop out window can't be reused in the Main window.
Copy link
Collaborator

@v-preethah v-preethah Jun 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The suspended app can be used within the same window. The app that is suspended in a pop out window can't be reused in the Main window.
* The suspended app can be used within the same window. The app that's suspended in a pop-up window can't be reused in the Main window.


* Apps are cached on a per-window basis. App caching happens on a per app (not on a per tab) basis within the same window.

* App caching isn't supported for the meeting stage or dialog (referred as task module in TeamsJS v1.x) contexts, because these can be opened on top of the tab and the same iframe or webview can't be used to render the content in the tab and the dialog.
* The table in the introductory section, [App suspension for your tab app](#app-suspension-for-your-tab-app), provides information about what `frameContext` Teams supports for caching. For non-Teams hubs, only `FrameContext.Content` is cached. That means, `FrameContext.Task`, which is inside `Dialog` isn't supported.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
* The table in the introductory section, [App suspension for your tab app](#app-suspension-for-your-tab-app), provides information about what `frameContext` Teams supports for caching. For non-Teams hubs, only `FrameContext.Content` is cached. That means, `FrameContext.Task`, which is inside `Dialog` isn't supported.
* The table in the introductory section, [App suspension for your tab app](#app-suspension-for-your-tab-app), provides information about what `frameContext` Teams supports for caching. For non-Teams hubs, only `FrameContext.Content` is cached, which means, `FrameContext.Task` that's inside `Dialog` isn't supported.

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.

5 participants