Merge branch 'hotfix_slow_message_sending' into develop
This commit is contained in:
@@ -1,10 +1,13 @@
|
|||||||
import {
|
import {
|
||||||
useStore_MessageLogs,
|
useStore_MessageLogs,
|
||||||
useStore_MessageInputValue,
|
useStore_MessageInputValue,
|
||||||
|
store,
|
||||||
} from "@store";
|
} from "@store";
|
||||||
|
|
||||||
import { useStdoutToPython } from "@useStdoutToPython";
|
import { useStdoutToPython } from "@useStdoutToPython";
|
||||||
|
|
||||||
|
const COOLDOWN = 2000; // 2 seconds
|
||||||
|
|
||||||
export const useMessage = () => {
|
export const useMessage = () => {
|
||||||
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
|
const { currentMessageLogs, addMessageLogs, updateMessageLogs } = useStore_MessageLogs();
|
||||||
const { currentMessageInputValue, updateMessageInputValue } = useStore_MessageInputValue();
|
const { currentMessageInputValue, updateMessageInputValue } = useStore_MessageInputValue();
|
||||||
@@ -65,7 +68,11 @@ export const useMessage = () => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
const startTyping = () => {
|
const startTyping = () => {
|
||||||
asyncStdoutToPython("/run/typing_message_box");
|
const now = Date.now();
|
||||||
|
if (now - store.last_executed_time_startTyping >= 2000) {
|
||||||
|
store.last_executed_time_startTyping = now;
|
||||||
|
asyncStdoutToPython("/run/typing_message_box");
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const stopTyping = () => {
|
const stopTyping = () => {
|
||||||
|
|||||||
@@ -22,6 +22,7 @@ export const store = {
|
|||||||
is_initialized_load_plugin: false,
|
is_initialized_load_plugin: false,
|
||||||
is_fetched_plugins_info_already: false,
|
is_fetched_plugins_info_already: false,
|
||||||
is_initialized_fetched_plugin_info: false,
|
is_initialized_fetched_plugin_info: false,
|
||||||
|
last_executed_time_startTyping: 0,
|
||||||
};
|
};
|
||||||
|
|
||||||
const generatePropertyNames = (base_name) => ({
|
const generatePropertyNames = (base_name) => ({
|
||||||
|
|||||||
Reference in New Issue
Block a user