-
Notifications
You must be signed in to change notification settings - Fork 74
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
Rename some functions in EventListener #1678
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -84,48 +84,61 @@ public open class EventListener { | |
} | ||
|
||
/** | ||
* Invoked on a request to create an unknown widget [kind]. | ||
* Invoked on a request to create an unknown widget with [tag]. This is a schema mismatch and the | ||
* widget is ignored. | ||
*/ | ||
public open fun onUnknownWidget( | ||
public open fun unknownWidget( | ||
tag: WidgetTag, | ||
) { | ||
} | ||
|
||
/** | ||
* Invoked on a request to create an unknown modifier [tag]. | ||
* Invoked on a request to create an unknown modifier with [tag]. This is a schema mismatch and | ||
* the modifier is ignored. | ||
*/ | ||
public open fun onUnknownModifier( | ||
public open fun unknownModifier( | ||
tag: ModifierTag, | ||
) { | ||
} | ||
|
||
/** | ||
* Invoked on a request to manipulate unknown children [tag] for the specified widget [kind]. | ||
* Invoked on a request to manipulate unknown children with [tag] for a widget with [widgetTag]. | ||
* This is a schema mismatch and the child nodes are ignored. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @JakeWharton is doing nothing here safe? If it isn’t, maybe we make a synthetic parent node? Ideally we don’t get further events for child nodes of the unknown child. My policy preference is to ignore the unknown children! There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There is no way to do that today. There is no "create" step for children so this event would happen for any child create/move/removes. Generally we don't have anything in place to remember an ignore of anything. So if you ignore creation of a widget with a certain ID you'll still get failures for every property change on that widget because the ID was never put into the map. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yeah, this may require some work. Tracking here: #1679 |
||
*/ | ||
public open fun onUnknownChildren( | ||
public open fun unknownChildren( | ||
widgetTag: WidgetTag, | ||
tag: ChildrenTag, | ||
) { | ||
} | ||
|
||
/** | ||
* Invoked on a request to set an unknown property [tag] for the specified widget [kind]. | ||
* Invoked on a request to set an unknown property with [tag] for a widget with [widgetTag]. This | ||
* is a schema mismatch and the property is ignored. | ||
*/ | ||
public open fun onUnknownProperty( | ||
public open fun unknownProperty( | ||
widgetTag: WidgetTag, | ||
tag: PropertyTag, | ||
) { | ||
} | ||
|
||
/** Invoked on a request to process an unknown event [tag] for the specified widget [widgetTag]. */ | ||
public open fun onUnknownEvent( | ||
/** | ||
* Invoked on a request to process an unknown event with [tag] for a widget with [widgetTag]. This | ||
* is a schema mismatch and the event is dropped. | ||
*/ | ||
public open fun unknownEvent( | ||
widgetTag: WidgetTag, | ||
tag: EventTag, | ||
) { | ||
} | ||
|
||
/** Invoked for an event whose node [id] is unknown. */ | ||
public open fun onUnknownEventNode( | ||
/** | ||
* Invoked when an event is received on a widget that no longer exists. | ||
* | ||
* This is a normal artifact of the asynchronous event processing used by Treehouse. For example, | ||
* it will occur if a user is still scrolling a `LazyColumn` when it is removed from a layout. The | ||
* scroll event is discarded and that's fine. | ||
*/ | ||
public open fun unknownEventNode( | ||
id: Id, | ||
tag: EventTag, | ||
) { | ||
|
@@ -338,7 +351,7 @@ public open class EventListener { | |
} | ||
|
||
public companion object { | ||
public val NONE: Factory = Factory { app, manifestUrl -> | ||
public val NONE: Factory = Factory { _, _ -> | ||
EventListener() | ||
} | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JakeWharton is doing nothing here safe?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I didn't write these so I'm not quite sure how this gets invoked. From what I would guess, the decision was already made at the Redwood layer to return
null
(i.e., ignore the widget) and here you can either log or escalate that to a throw.