await a promise set in a pre navigation hook
Hi All,
I have a pre navigation hook that listens for requests and if they return images saves them to the cloud
This works in 95% of cases however there are some where the main request hander completes before each
res.response()
can be collected. This causes an error since the browser context closes with the main request handler. My question is how can i best get around this? One idea I had was that I could put a promise in the page userdata that resolves when the page has no outstanding images. After reading the docs however im not sure if this is possible since userdata needs to be serialisable? Has anyone else encountered this type of issue and how have they got around it?3 Replies
Someone will reply to you shortly. In the meantime, this might help:
Hi @Crafty If I understand it correctly, the simplest solution would be to have global variable and match it with the request.
Sometimes I see people passing their own variables to the
context
which is then passed to the routeHandler
optimistic-goldOP•7mo ago
Hi, thanks for this. It should solve my problem nicely. 🙂