Skip to content

Commit 080df1e

Browse files
Copilothotlong
andcommitted
Address code review feedback: add clarifying comments
- Add comment explaining backward compatibility behavior in Registry.register() - Add comments to PluginSystem tests explaining legacy mode usage - Clarify that last registration wins for non-namespaced lookups Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent f31af0d commit 080df1e

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

packages/core/src/registry/Registry.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,8 @@ export class Registry<T = any> {
9292

9393
// Also register without namespace for backward compatibility
9494
// This allows "button" to work even when registered as "ui:button"
95+
// Note: If multiple namespaced components share the same short name,
96+
// the last registration wins for non-namespaced lookups
9597
if (meta?.namespace) {
9698
this.components.set(type, {
9799
type: fullType, // Keep reference to namespaced type

packages/core/src/registry/__tests__/PluginSystem.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ describe('PluginSystem', () => {
2828
}
2929
};
3030

31+
// Use legacy mode (useScope: false) to test direct registry access
3132
await pluginSystem.loadPlugin(plugin, registry, false);
3233

3334
expect(pluginSystem.isLoaded('test-plugin')).toBe(true);
@@ -201,6 +202,7 @@ describe('PluginSystem', () => {
201202
register: registerFn
202203
};
203204

205+
// Use legacy mode (useScope: false) to verify the raw Registry is passed
204206
await pluginSystem.loadPlugin(plugin, registry, false);
205207

206208
expect(registerFn).toHaveBeenCalledWith(registry);

0 commit comments

Comments
 (0)