We have enabled deep linking in Microsoft Teams Tabs. We are generating link to the custom tabs with subEntityId as mentioned in Microsoft docs
https://teams.microsoft.com/l/entity/<appId>/<entityId>?webUrl=<entityWebUrl>&label=<entityLabel>&context=<context>
In home page, we are using Ms Teams Js SDK and calling getContext() for retrieving the subEntityId passed in the URL.
We used the following code for navigating to different page based on subEntityId
microsoftTeams.initialize();
microsoftTeams.getContext(function (context) {
console.log(context);
let currentUrl = window.location.href;
let isAdmin = false;
if(currentUrl.indexOf('admin') > 0){
isAdmin = true;
}
let subEntityId = context.subEntityId;
let redirectUrl = "";
if(subEntityId == "all-tasks")
{
redirectUrl = isAdmin ?
window.location.origin + "/admin/task/all-tasks" :
window.location.origin + "/member/task/all-tasks";
}
microsoftTeams.setContext
if(redirectUrl != ""){
window.location.assign(redirectUrl);
}
});
but when we are navigating back to home page using navigation bar (not by using any back button) it is automatically redirecting back. The subEntityId is not resetting and on home page load it is picking the id and navigating again.
Please help, is there any possible way to reset or set the subEntityId as empty.
Thank you.