You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Since one can use the same component more than once we should avoid calling _register_component more than once if it's already been done. A simple containment check in IDOM_REGISTERED_COMPONENTS should work here.
Accidentally commented on the wrong issue before, so I'm reposting here
Caching the register function with functools.cache would provide the same ability to skip re-registration, and would allow us to skip the sys.modules check. Could be slightly more performant than checking IDOM_REGISTERED_COMPONENTS.
Note: recently discovered there is no performance penalty for importing a module more than one time. Apparently importlib already does a sys.modules check. Which means we can remove this LOC.
Activity
Archmonger commentedon Aug 19, 2021
Accidentally commented on the wrong issue before, so I'm reposting here
Caching the register function with
functools.cachewould provide the same ability to skip re-registration, and would allow us to skip thesys.modulescheck. Could be slightly more performant than checkingIDOM_REGISTERED_COMPONENTS.Archmonger commentedon Aug 31, 2021
Note: recently discovered there is no performance penalty for importing a module more than one time. Apparently importlib already does a
sys.modulescheck. Which means we can remove this LOC.See here for more details.
prevent duplicate component registration fix reactive-python#5