Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: remove console log messages on theme change #832

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 0 additions & 4 deletions frontend/src/app.js
Original file line number Diff line number Diff line change
Expand Up @@ -58,10 +58,6 @@ const App = () => {
localStorage.setItem("dark", !theme);
}

useEffect(() => {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If u remove the useEffect here, how will the component re-render after the theme change?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@Kajol-Kumari I think in this case it doesn't perform any side effects or log messages based on theme changes, and if the component doesn't rely on these changes to trigger a re-render, we can safely remove the useEffect block. The component will still re-render when its state or props change. What are your thoughts on this?

console.log("Theme changed");
}, [theme, toast]);

useEffect(() => {
window.scrollTo(0, 0);
}, [pathname]);
Expand Down
1 change: 0 additions & 1 deletion frontend/src/components/util/ScrollToTop/ScrollToTop.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import style from "./scroll-to-top.module.scss";

export const ScrollTop = (props) => {
let dark = props.theme;
console.log(dark);
const [showScroll, setShowScroll] = useState(false);

const checkScrollTop = () => {
Expand Down
Loading