Yes — what you’re seeing is normal behavior in Flarum’s Mithril-based component lifecycle. Components like UserPage can re-render multiple times due to redraws triggered by async data loads or UI updates. As long as your function is lightweight and idempotent (i.e., it doesn’t duplicate items or cause side effects), there’s no real performance issue.
Best practices:
Keep logic minimal inside extend() calls.
Guard against duplicate menu items (e.g., check if the key already exists in items).
Avoid expensive computations or DOM manipulations inside render hooks.
For heavier logic, use event listeners or lifecycle hooks (oncreate, onupdate) instead.
In short, double rendering is expected in Flarum — just ensure your code handles re-renders gracefully.