Skip to content

Commit f06c925

Browse files
committed
refactor: ♻️ Remove debounce from React-Live onChange handler
- Resolved the cursor position reset issue while typing in progress
1 parent 13f83bb commit f06c925

File tree

1 file changed

+2
-3
lines changed

1 file changed

+2
-3
lines changed

docs-site/src/components/Example/index.tsx

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@ import { fi } from "date-fns/locale/fi";
1111
import { ptBR } from "date-fns/locale/pt-BR";
1212
import { enGB } from "date-fns/locale/en-GB";
1313
import copy from "copy-to-clipboard";
14-
import { debounce } from "lodash";
1514
import slugify from "slugify";
1615
import range from "lodash/range";
1716
import { themes } from "prism-react-renderer";
@@ -94,15 +93,15 @@ export default class CodeExampleComponent extends React.Component<
9493
}
9594
};
9695

97-
handleCodeChange = debounce((code: string) => {
96+
handleCodeChange = (code: string) => {
9897
const { activeTab } = this.state;
9998
const codeProp = activeTab === "ts" ? "tsxCode" : "jsxCode";
10099

101100
this.setState((state) => ({
102101
...state,
103102
[codeProp]: code,
104103
}));
105-
}, 500);
104+
};
106105

107106
handleTabChange = async (tab: TState["activeTab"]) => {
108107
const { tsxCode } = this.state;

0 commit comments

Comments
 (0)