linkedin/Hakawai

Mentions chooser view showing initially for no reason

arielpollack opened this issue · 3 comments

Hey, I've updated to 7.1.0 and now the mentions chooser opens right away on textView.becomeFirstResponder().

It looks like the issue is with this check:
6.0.1 ... 7.1.0

if ((self.state != HKWMentionsCreationStateQuiescent || self.searchType == HKWMentionsSearchTypeInitial)
        && self.chooserState == HKWMentionsCreationChooserStateHidden) {
        [self showChooserView];
    }

HKWMentionsPlugin calls the state machine's fetchInitialMentions method which set's the searchType to Initial and make this check succeed initially and thus shows the chooser view.

I don't understand the logic completely in order to fix it or point where the issue is, but currently, I need to rollback to the previous version as this one is not production ready for our usage.

I am facing the same issue, and this happen since 6.0.2

@caroltam as a workaround I'm just returning with no call to the completion block in case the searchType is HKWMentionsSearchTypeInitial:

- (void)asyncRetrieveEntitiesForKeyString:(NSString *)keyString
                               searchType:(HKWMentionsSearchType)type
                         controlCharacter:(unichar)character
                               completion:(void (^)(NSArray *, BOOL, BOOL))completionBlock {
    if (!completionBlock || type == HKWMentionsSearchTypeInitial) {
        return;
    }
    ....
nkark commented

@arielpollack thank you!