admin管理员组文章数量:1295728
This problem is, if my page, that employs workbox-webstreams sents a request to the server, let say 3 streams hits the sever( NetworkFirst
) and it has a redirect to a login page because session has expired, what I get is my page (the one that shoots the request) now have it mangeld with 3 login page html.
my question is, how can i isntruct workbox to abandon streaming and make a full page reload(or redirect)?
Well, one solutiion i tried, since i was using htmx
, if the request was made by htmx (i.e not a navigation request), i can do a client side redirecting, which works but my problem is with navigation request via workbox (which employs webstream).
Below is an example of webstream with workbox, as you'll notice two of these stream hits the server first, if user sessions has expired, i get my page mangled with 2 login page.
export const dashboardPageStream = composeStrategies(
[
async ({ event }) =>
staleWhileRevalidateStrategy.handle({
request: new Request("/account/dashboard/openingHtmlTag-Partial.html"),
event,
}),
async ({ event }) =>
networkFirstStrategy.handle({
request: new Request("/account/dashboard/commonHeader-Partial.html"),
event,
}),
async ({ event }) =>
cacheFirstStrategy.handle({
request: new Request("/account/dashboard/mainOpeningTag-Partial.html"),
event,
}),
async ({ event }) =>
staleWhileRevalidateStrategy.handle({
request: new Request("/account/dashboard/swiperOne"),
event,
}),
async ({ event }) =>
networkFirstStrategy.handle({
request: new Request("/account/dashboard/echarts?month=0"),
event,
}),
async ({ event }) =>
staleWhileRevalidateStrategy.handle({
request: new Request("/account/dashboard/swiperTwo"),
event,
}),
async ({ event }) =>
cacheFirstStrategy.handle({
request: new Request("/account/dashboard/footer-Partial.html"),
event,
}),
async ({ event }) =>
staleWhileRevalidateStrategy.handle({
request: new Request("/account/dashboard/closingHtmlTag-Partial.html"),
event,
}),
],
{}
);
本文标签: Workbox webstreaming reacting to redirect from a substreamStack Overflow
版权声明:本文标题:Workbox webstreaming reacting to redirect from a [sub]-stream - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741623264a2388935.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论