Skip to content
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

Crash and settings reset on iPad after using keyboard to switch back to NNW and closing webview #4481

Open
barrymieny opened this issue Jan 12, 2025 · 8 comments

Comments

@barrymieny
Copy link

I randomly experience this behaviour where when I open an article from an NNW webview into Safari, and then go back to NNW (with cmd + tab on the keyboard) and closing the webview (with cmd-W on the keyboard) it crashes NNW.

When I then reopen NNW, it’s like a fresh install where all the filter and sort settings have been lost and are back to the defaults of newest articles first and showing unread and read articles. It’s just the view settings though, since all subscriptions are untouched.

I use a Magic Keyboard, but I am assuming the behaviour would be consistent regardless of which physical keyboard is used.

@stuartbreckenridge
Copy link
Member

What version of NNW and iPadOS are you using?

@barrymieny
Copy link
Author

barrymieny commented Jan 12, 2025

Sorry, should have thought of including that.

  • iPadOS 18.2 (22C152)
  • NNW 6.1.6 (Build 6142)

But, to be clear, this has been ongoing for quite some time, so it stretches back to at least iPadOS 17.5 and NNW 6.1.4.

@stuartbreckenridge
Copy link
Member

This isn't a crash.

⌘ + W will close the window—essentially, the app—not the webview. That said, the issue here is that state restoration doesn't appear to be working when exiting the app with ⌘ + W which is why everything seems to be reset when you open the app again.

@barrymieny
Copy link
Author

Alright, so what you're saying is that when opening an article in the web view, it has focus and ⌘ + W closes the web view, but when you then open the article in an external app (such as Safari) and then return to NNW, the web view has lost focus and ⌘ + W closes the app (which now has focus)?

You also say "seems to be reset". So, does that mean the settings are actually saved somewhere and NNW just isn't reading/using them -- and that's the bug?

@stuartbreckenridge
Copy link
Member

No. Based on the brief behaviour I've tested in the simulator, the application will always terminate with ⌘ + W unless you have more than one NNW window running (which makes sense).

The flow of what happens after ⌘ + W is below:

-- launch app
scene(_:willConnectTo:options:)
sceneWillEnterForeground(_:)
-- ⌘ + W
stateRestorationActivity(for:)
sceneDidEnterBackground(_:)
applicationWillTerminate(_:)

In the above scenario, state restoration doesn't work.

However, if you kill the app via the app switcher, state restoration works despite the flow being the same:

-- launch app
scene(_:willConnectTo:options:)
sceneWillEnterForeground(_:)
-- kill app via app switcher
stateRestorationActivity(for:)
sceneDidEnterBackground(_:)
applicationWillTerminate(_:)

We need to investigate the ⌘ + W behaviour a bit further.

cc @brentsimmons

@barrymieny
Copy link
Author

No. Based on the brief behaviour I've tested in the simulator, the application will always terminate with ⌘ + W unless you have more than one NNW window running (which makes sense).

Could that point to a discrepancy in the behaviour between the simulator and the app running on a device, since I always use ⌘ + W to close the web view after reading an article?

Or does a web view being open on iPad equal more than one NNW window on iPad?

@stuartbreckenridge
Copy link
Member

I see the same behaviour on device.

⌘ + W is a global keyboard shortcut...if you're in NNW hold down to see the list of shortcuts the app provides and ⌘ + W isn't one of them.

I can only find two instances where ⌘ + W will not close NNW:

  1. There is > 1 NNW window
Screenshot 2025-01-12 at 21 10 16
  1. You've tapped a link in an article and NNW is configured to open that link in NNW inside a Safari View Controller (in this case ⌘ + W dismisses the Safari View)
Screenshot 2025-01-12 at 21 11 10

@barrymieny
Copy link
Author

Thanks for all the insight.

The second example is what I've been talking about. So, I'll just try to remember to not use ⌘ + W when returning from outside NNW to that web view.

If the bug of the state restoration (I assume you'll be creating a bug ticket for that) is resolved at some point, at least the only inconvenience will be having to reopen NNW when I hit ⌘ + W out of habit.

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

No branches or pull requests

3 participants