fix(ui): profile modal controller instantiation order

- Moved controller instantiation (DM, Relay, Hashtag) to after services setup in `ProfileModalController.js`.
- Fixed `ProfileHashtagController` usage of uninitialized services.
- Updated `profile-modal-controller.test.mjs` mock to include `uiReady/dataReady` flags and use correct service access pattern.
- Resolved CI failures in `profile-modal-controller.test.mjs`.

Co-authored-by: PR0M3TH3AN <[email protected]>
This commit is contained in:
google-labs-jules[bot]andPR0M3TH3AN committed 2026-02-13 03:50:42 +00:00
1 parent f8b8bae2e8
commit 4059d52847
2 files changed
+12 -10

No files matched your search

+9 -9
View File
@@ -96,11 +96,6 @@ export class ProfileModalController {
this.showStatus = showStatus;
this.designSystem = normalizeDesignSystemContext(designSystem);
this.dmController = new ProfileDirectMessageController(this);
this.relayController = new ProfileRelayController(this);
this.hashtagController = new ProfileHashtagController(this);
this.hashtagController.initialize();
const resolvedMaxWalletDefaultZap =
typeof providedConstants.MAX_WALLET_DEFAULT_ZAP === "number" &&
Number.isFinite(providedConstants.MAX_WALLET_DEFAULT_ZAP)
@@ -168,8 +163,6 @@ export class ProfileModalController {
this.adminSuperNpub = resolvedAdminSuperNpub;
this.adminDmImageUrl = resolvedAdminDmImageUrl;
this.bitvidWebsiteUrl = resolvedbitvidWebsiteUrl;
this.dmController.enableNip17RelayWarning = resolvedEnableNip17RelayWarning;
this.dmController.hasShownRelayWarning = false;
this.internalState = {
savedProfiles: [],
@@ -183,11 +176,18 @@ export class ProfileModalController {
dmRelayHints: new Map(),
};
this.dmController.dmMobileView = "list";
this.services = buildServicesContract(services, this.internalState);
this.state = buildStateContract(state, this.internalState);
this.dmController = new ProfileDirectMessageController(this);
this.relayController = new ProfileRelayController(this);
this.hashtagController = new ProfileHashtagController(this);
this.hashtagController.initialize();
this.dmController.enableNip17RelayWarning = resolvedEnableNip17RelayWarning;
this.dmController.hasShownRelayWarning = false;
this.dmController.dmMobileView = "list";
this.normalizeHexPubkey = this.services.normalizeHexPubkey;
this.safeEncodeNpub = this.services.safeEncodeNpub;
this.safeDecodeNpub = this.services.safeDecodeNpub;
+3 -1
View File
@@ -312,6 +312,8 @@ function createController(options = {}) {
eventId: null,
createdAt: null,
loaded: true,
uiReady: true,
dataReady: true,
}),
describeHashtagPreferencesError: () => '',
onAccessControlUpdated: async () => {},
@@ -961,7 +963,7 @@ for (const _ of [0]) {
const interestList = document.getElementById('profileHashtagInterestList');
assert.equal(interestList?.querySelectorAll('li').length, 1);
controller.hashtagPreferencesService.removeInterest('art');
controller.services.hashtagPreferences.removeInterest('art');
await controller.handleAuthLogout({});
await waitForAnimationFrame(window, 2);