Skip to content

Commit ee48c84

Browse files
committed
Fix stories
1 parent 2898664 commit ee48c84

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

‎src/components/chat/input.ts

+11-8
Original file line numberDiff line numberDiff line change
@@ -348,7 +348,9 @@ export default class ChatInput {
348348

349349
private fileSelectionPromise: CancellablePromise<File[]>;
350350

351-
public readonly paidMessageInterceptor: PaidMessagesInterceptor;
351+
public paidMessageInterceptor: PaidMessagesInterceptor;
352+
353+
private starsState: ReturnType<ChatInput['constructStarsState']>;
352354

353355
constructor(
354356
public chat: Chat,
@@ -361,12 +363,6 @@ export default class ChatInput {
361363
this.excludeParts = {};
362364
this.isFocused = false;
363365
this.emoticonsDropdown = emoticonsDropdown;
364-
365-
this.paidMessageInterceptor = new PaidMessagesInterceptor(chat, managers);
366-
367-
this.getMiddleware().onDestroy(() => {
368-
this.paidMessageInterceptor.dispose();
369-
});
370366
}
371367

372368
public construct() {
@@ -477,6 +473,13 @@ export default class ChatInput {
477473
const c = this.controlContainer = document.createElement('div');
478474
c.classList.add('chat-input-control', 'chat-input-wrapper');
479475
this.inputContainer.append(c);
476+
477+
this.paidMessageInterceptor = new PaidMessagesInterceptor(this.chat, this.managers);
478+
this.getMiddleware().onDestroy(() => {
479+
this.paidMessageInterceptor.dispose();
480+
});
481+
482+
this.starsState = this.constructStarsState();
480483
}
481484

482485
public freezeFocused(focused: boolean) {
@@ -3470,7 +3473,7 @@ export default class ChatInput {
34703473
this.updateMessageInputPlaceholder(params);
34713474
}
34723475

3473-
private starsState = createRoot(dispose => {
3476+
private constructStarsState = () => createRoot((dispose) => {
34743477
const middleware = this.getMiddleware();
34753478
middleware.onDestroy(() => void dispose());
34763479

‎src/lib/appManagers/appReactionsManager.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export class AppReactionsManager extends AppManager {
339339
// }
340340

341341
public getAvailableReactionsByMessage(
342-
message: Message.message,
342+
message?: Message.message,
343343
unshiftQuickReaction?: boolean
344344
): ReturnType<AppReactionsManager['getAvailableReactionsForPeer']> {
345345
// if(!message) return {type: 'chatReactionsNone', reactions: []};
@@ -368,7 +368,7 @@ export class AppReactionsManager extends AppManager {
368368
return callbackify(
369369
this.getAvailableReactionsForPeer(peerId, unshiftQuickReaction),
370370
(peerAvailableReactions) => {
371-
const messageReactionsResults = message.reactions?.results;
371+
const messageReactionsResults = message?.reactions?.results;
372372
if(
373373
messageReactionsResults &&
374374
peerAvailableReactions.type === 'chatReactionsSome' &&

0 commit comments

Comments
 (0)