tauri-apps / tauri

Build smaller, faster, and more secure desktop and mobile applications with a web frontend.
https://tauri.app
Apache License 2.0
83.37k stars 2.5k forks source link

[bug] Frontend reloads on wake after sleep in Windows 11 #8304

Closed ottosson closed 4 months ago

ottosson commented 10 months ago

Describe the bug

When I put my computer to sleep and wake it up again all state has been lost on the frontend of my Tauri application. The page seems to be reloaded. The state is till available for the "backend" of my application.

Reproduction

On windows 11, start your Tauri app, then put the computer to sleep, then wake it up again. State on frontend is lost.

Expected behavior

No response

Platform and versions

[✔] Environment
    - OS: Windows 10.0.22621 X64
    ✔ WebView2: 119.0.2151.72
    ✔ MSVC:
        - Visual Studio Build Tools 2019
        - Visual Studio Professional 2022
    ✔ rustc: 1.74.0 (79e9716c9 2023-11-13)
    ✔ cargo: 1.74.0 (ecb9851af 2023-10-18)
    ✔ rustup: 1.26.0 (5af9b9484 2023-04-05)
    ✔ Rust toolchain: stable-x86_64-pc-windows-msvc (default)
    - node: 20.8.1
    - npm: 10.2.0

Stack trace

No response

Additional context

No response

GregorGT commented 6 months ago

Same behavior on our build: https://github.com/GregorGT/RuNo/ (Adding the comment to stay updated)

ottosson commented 4 months ago

This is still an issue for me.

Is this a WebView2 or a Tauri related issue? This feels like it should be a much more common issue for people. Can't be just me and @GregorGT.

ahqsoftwares commented 4 months ago

@ottosson Sadly it is a chromium bug. Basically I've tried at 3 browsers (brave, edge, firefox) and tauri

Brave, edge and tauri (windows) does reload the page Firefox doesn't

That's my findings, lemme open source the code I've used

ahqsoftwares commented 4 months ago

Here's the repo https://github.com/ahqsoftwares/tauri-webview-reload-test

ahqsoftwares commented 4 months ago

Conversation: https://discord.com/channels/616186924390023171/731495028677148753/1246008474039619596

It apparently does not happen in production

ottosson commented 4 months ago

If it is a Chromium bug shouldn't Electron be affected? I haven't experienced it there.

GregorGT commented 4 months ago

The bug is not a damper for production. I stumbled on that as well @ahqsoftwares. I am going to unsubscribe.... as this is not really a bug. It only happens in dev.

ottosson commented 4 months ago

Yup, same for me. A bit annoying but not as bad as I first feared.

ahqsoftwares commented 4 months ago

@ottosson soooo, I guess this issue is more/less resolved? Cuz it doesn't happen in prod

ottosson commented 4 months ago

@ottosson soooo, I guess this issue is more/less resolved? Cuz it doesn't happen in prod

Ok I'll drop this for now 😉 Thanks for helping shed some light on the situation @ahqsoftwares