Skip to content

Commit

Permalink
feat(istrue): handle bug
Browse files Browse the repository at this point in the history
  • Loading branch information
tikrack committed Feb 8, 2025
1 parent 791352d commit 30119b2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
7 changes: 6 additions & 1 deletion src/components/config/SalamConfig.jsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
import { useEffect, useState } from "react";
import { useContext, useEffect, useState } from "react";
import Run from "../run/Run.jsx";
import { useLocation } from "react-router-dom";
import { toast } from "react-hot-toast";
import Svg from "../shared/Svg.jsx";
import TrueContext from "../../context/TrueContext.jsx";

// eslint-disable-next-line react/prop-types
const ToastMessage = ({ text }) => {
Expand All @@ -27,6 +28,7 @@ const ToastMessage = ({ text }) => {
const SalamConfig = () => {
const [isReady, setIsReady] = useState(false);
const location = useLocation();
const { isTrue, setIsTrue } = useContext(TrueContext);

useEffect(() => {
window.code = "";
Expand Down Expand Up @@ -55,6 +57,8 @@ const SalamConfig = () => {
},
print: (text) => {
toast.remove(id);
setIsTrue(true);
console.log(isTrue);
window.code += text;
window.true = true;
console.log(
Expand All @@ -70,6 +74,7 @@ const SalamConfig = () => {
);
},
printErr: (text) => {
setIsTrue(false);
window.true = false;
console.error(
"%cprint-Log => " + text,
Expand Down
4 changes: 2 additions & 2 deletions src/provider/TrueProvider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const TrueProvider = ({ children }) => {
const location = useLocation();

useEffect(() => {
console.log("Checking is true code?");
}, [location]);
console.log("Location or isTrue changed:", { location, isTrue });
}, [location, isTrue]);

return (
<TrueContext.Provider value={{ isTrue, setIsTrue }}>
Expand Down

0 comments on commit 30119b2

Please sign in to comment.