-
-
Notifications
You must be signed in to change notification settings - Fork 4.3k
Description
Component's init_component_hooks method is intimidating and a bit frustrating to use. The obvious solution is to simply make each type of component hook its own method.
As @James-o-brien points out, the most naive solution won't work, because we want to cache whether or not each component has each kind of hook (stored in the flags on archetypes). As far as we know, there's no way to statically check if the function provided is actually a no-op.
This came up in the context of relationships.
This feels like a weird place for this method. I'd kinda prefer making
on_insertetc methods forComponent(and removing the awkwardregister_component_hooksAPI), and then generating those methods in theComponenttrait with theRelationshipderive macro.
Originally posted by @alice-i-cecile in #17398 (comment)