💄 Optimize and bug fixes in auto complete
This commit is contained in:
@@ -550,11 +550,13 @@ class ChatInput extends HookConsumerWidget {
|
|||||||
final triggerIndex =
|
final triggerIndex =
|
||||||
atIndex > colonIndex ? atIndex : colonIndex;
|
atIndex > colonIndex ? atIndex : colonIndex;
|
||||||
if (triggerIndex == -1) return [];
|
if (triggerIndex == -1) return [];
|
||||||
|
final chopped = pattern.substring(triggerIndex);
|
||||||
|
if (chopped.contains(' ')) return [];
|
||||||
final service = ref.read(autocompleteServiceProvider);
|
final service = ref.read(autocompleteServiceProvider);
|
||||||
try {
|
try {
|
||||||
return await service.getSuggestions(
|
return await service.getSuggestions(
|
||||||
chatRoom.id,
|
chatRoom.id,
|
||||||
pattern,
|
chopped,
|
||||||
);
|
);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [];
|
return [];
|
||||||
@@ -645,7 +647,7 @@ class ChatInput extends HookConsumerWidget {
|
|||||||
direction: VerticalDirection.up,
|
direction: VerticalDirection.up,
|
||||||
hideOnEmpty: true,
|
hideOnEmpty: true,
|
||||||
hideOnLoading: true,
|
hideOnLoading: true,
|
||||||
debounceDuration: const Duration(milliseconds: 500),
|
debounceDuration: const Duration(milliseconds: 1000),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
IconButton(
|
IconButton(
|
||||||
|
@@ -149,9 +149,11 @@ class ComposeFormFields extends HookConsumerWidget {
|
|||||||
final triggerIndex =
|
final triggerIndex =
|
||||||
atIndex > colonIndex ? atIndex : colonIndex;
|
atIndex > colonIndex ? atIndex : colonIndex;
|
||||||
if (triggerIndex == -1) return [];
|
if (triggerIndex == -1) return [];
|
||||||
|
final chopped = pattern.substring(triggerIndex);
|
||||||
|
if (chopped.contains(' ')) return [];
|
||||||
final service = ref.read(autocompleteServiceProvider);
|
final service = ref.read(autocompleteServiceProvider);
|
||||||
try {
|
try {
|
||||||
return await service.getGeneralSuggestions(pattern);
|
return await service.getGeneralSuggestions(chopped);
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -235,7 +237,7 @@ class ComposeFormFields extends HookConsumerWidget {
|
|||||||
direction: VerticalDirection.down,
|
direction: VerticalDirection.down,
|
||||||
hideOnEmpty: true,
|
hideOnEmpty: true,
|
||||||
hideOnLoading: true,
|
hideOnLoading: true,
|
||||||
debounceDuration: const Duration(milliseconds: 500),
|
debounceDuration: const Duration(milliseconds: 1000),
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
|
Reference in New Issue
Block a user