reports icon indicating copy to clipboard operation
reports copied to clipboard

FB11522170: Reloading widget timeline from an AppIntent does not reload the timeline immediately

Open sindresorhus opened this issue 2 years ago • 4 comments

  • Date: 2022-09-16
  • Resolution: Open
  • Area: WidgetKit
  • OS: iOS 16.0
  • Type: Incorrect/Unexpected Behavior

Description

If you call WidgetCenter.shared.reloadAllTimelines() inside the perform method of an AppIntent (in-app intent), the widget timeline is not reloaded right away. Sometimes it takes minutes. My theory is that it’s because an AppIntent runs in a background scene, and it gets lower priority. However, I would argue that an intent is a user-driven interaction and should get high priority.

My specific use-case: I have an app that provides Lock Screen widgets with some text. It also provides a Shortcuts action (AppIntent) to update that text. When the user changes the text from the app, it updates right away, but when they use the Shortcuts action to update the text, it sometimes takes minutes. The causes a bad user-experience for the user, which explicitly wanted the text to update right away.

The docs for WidgetCenter.shared.reloadAllTimelines() says:

Reloads the timelines for all configured widgets belonging to the containing app.

There’s nothing there about updates being delayed. If there are restrictions on this, it should be noted in the docs.

My intent is simply this:

struct SetTextIntent: AppIntent {
	// …

	@Parameter(title: "Text")
	var text: String

	func perform() async throws -> some IntentResult {
		updateText(text)
		WidgetCenter.shared.reloadAllTimelines()
		return .result()
	}
}

I have confirmed that the widget getTimeline delegate method often does not get called after this.

sindresorhus avatar Sep 16 '22 08:09 sindresorhus

Same here. Also submitted a FB.

gongzhang avatar Sep 11 '23 14:09 gongzhang

Any Updates on this one?

SebastianBoldt avatar Jan 07 '24 09:01 SebastianBoldt

@SebastianBoldt This is not maintained by Apple. This is a mirror of reports. Apple has not yet responded to the original report.

sindresorhus avatar Jan 07 '24 09:01 sindresorhus