[2.x] fix: register Input in the common export manifest - #4929
Merged
Conversation
Input is public extension API but was never listed in common.ts, the manifest that eagerly registers components with the export registry. It reached the forum bundle only incidentally, via AbstractGlobalSearch's static import. #4909 replaced that Input with a plain button and dropped the import, leaving the lazily-loaded SearchModal as its only forum-side importer. Webpack therefore moved Input into the SearchModal chunk, where it is registered with addChunkModule instead of reg.add. Extensions resolve core components synchronously through reg.get, which returns undefined for a chunk-only module, so any extension rendering flarum/common/components/Input throws until something else loads the search modal chunk.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Changes proposed in this pull request:
Inputis public extension API — documented attrs, shipped typings — but it was never listed incommon.ts, the manifest that eagerly registers components with the export registry. It only reached the forum bundle incidentally, becauseAbstractGlobalSearchimported it statically.#4909 replaced that
<Input>with a plain button and dropped the import. That leaves the lazily-loadedSearchModalas the only forum-side importer, so webpack movedInputinto theSearchModalchunk — in the builtforum.jsit now appears only asaddChunkModule, neverreg.add.Extensions resolve core components synchronously via
reg.get(), which returnsundefinedfor a chunk-only module. So any extension renderingflarum/common/components/Inputthrows "The selector must be either a string or a component" on first render —fof/ui-kit'sDiscussionSearchis one, which breaksfof/move-posts. It recovers only once something else loads the search modal chunk.Adding
Inputtocommon.tsrestores the eager registration.Reviewers should focus on:
Whether other public components are in the same position. Bundle membership is an emergent property of which modules core happens to import statically, so any refactor that removes core's last eager import silently demotes a public component to chunk-only — no build error, no type error, just
undefinedat runtime in downstream extensions. A test asserting the documented public surface isreg.add'd in the built bundles would catch the next one; happy to follow up with that separately if wanted.Necessity
Confirmed
yarn testinjs/).