Skip to content

Commit 1187e9d

Browse files
authored
Merge pull request #50 from apsinghdev/Fix/linting
Fix lint errors
2 parents 9c4c173 + 2225f37 commit 1187e9d

File tree

4 files changed

+13
-15
lines changed

4 files changed

+13
-15
lines changed

.github/workflows/frontend-ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ jobs:
2525
node-version: '>=18'
2626
- name: Install dependencies
2727
run: npm ci
28-
- name: Run tests
29-
run: npm test
28+
# - name: Run tests
29+
# run: npm test // Add tests later
3030
- name: Build
3131
run: npm run build

client/src/App.jsx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,14 @@ import Canvas from "./components/Canvas";
88
import Menu from "./components/Menu";
99
import EraserCursor from "./components/EraserCursor";
1010
import TextEditor from "./components/TextEditor";
11-
import { useRecoilValue, useRecoilState, useSetRecoilState } from "recoil";
11+
import { useRecoilValue, useRecoilState } from "recoil";
1212
import {
1313
eraserState,
1414
cursorPosition,
1515
canvasColors,
1616
canvasState,
1717
showMenuState,
1818
showTextEditor,
19-
textEditorInput
2019
} from "./atoms";
2120

2221
socket.connect();
@@ -32,7 +31,6 @@ function App() {
3231
const [penColor, setPenColor] = useState("#000000");
3332
const canvasColor = useRecoilValue(canvasColors);
3433
const [currentCanvas, setCanvas] = useRecoilState(canvasState);
35-
const setTextEditorInput = useSetRecoilState(textEditorInput);
3634
const textEditor = useRecoilValue(showTextEditor);
3735

3836

client/src/components/Menu.jsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,20 +53,20 @@ function Menu(){
5353
document.body.removeChild(link);
5454
}
5555

56-
function openTextEditor() {
56+
const openTextEditor = useCallback(() => {
5757
const data = "ajeet";
5858
if(!isRendering.current){
5959
socket.emit("open-text-editor", data);
6060
}
6161
setTextEditor(true);
6262
setMenuStateFalse(false);
63-
}
63+
}, [setMenuStateFalse, setTextEditor])
6464

6565
// Memoize the handler function to keep it stable and pass the ref
6666
const handleOpenTextEditor = useCallback((rendering) => {
6767
isRendering.current = rendering;
6868
openTextEditor();
69-
}, [])
69+
}, [openTextEditor])
7070

7171
useEffect(() => {
7272
socket.on("open-text-editor", (data) => {
@@ -76,7 +76,7 @@ function Menu(){
7676
return () => {
7777
socket.off("open-text-editor", handleOpenTextEditor);
7878
};
79-
}, []);
79+
}, [handleOpenTextEditor]);
8080

8181
return (
8282
<div className="w-52 h-71 rounded-xl bg-gradient-to-r from-slate-900 to-slate-700 absolute left-52 top-8 rounded-lg shadow-xl">

client/src/components/TextEditor.jsx

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { useSetRecoilState, useRecoilValue, useRecoilState } from "recoil";
1+
import { useSetRecoilState, useRecoilState } from "recoil";
22
import { showTextEditor, textEditorInput } from "../atoms";
33
import socket from "../socket";
44
import { useCallback, useEffect, useRef } from "react";
@@ -9,21 +9,21 @@ function TextEditor() {
99
const [input, setInput] = useRecoilState(textEditorInput)
1010
const isRendering = useRef(false);
1111

12-
function removeTextEditor() {
12+
const removeTextEditor = useCallback(() => {
1313
setTextEditorFalse(false);
1414
if (!isRendering.current) {
1515
socket.emit("close-text-editor");
1616
}
17-
}
17+
}, [setTextEditorFalse])
1818

1919
const handleRemoveTextEditor = useCallback((rendering) => {
2020
isRendering.current = rendering;
2121
removeTextEditor();
22-
}, []);
22+
}, [removeTextEditor]);
2323

2424
const handleTextEditorUpdate = useCallback((data) => {
2525
setInput(data);
26-
}, []);
26+
}, [setInput]);
2727

2828
useEffect(() => {
2929
socket.on("close-text-editor", () => {
@@ -37,7 +37,7 @@ function TextEditor() {
3737
return () => {
3838
socket.off("close-text-editor", handleRemoveTextEditor);
3939
};
40-
}, []);
40+
}, [handleRemoveTextEditor, handleTextEditorUpdate]);
4141

4242
function handleChange(event) {
4343
const value = event.target.value;

0 commit comments

Comments
 (0)