Skip to content
This repository has been archived by the owner on Aug 15, 2022. It is now read-only.

Commit

Permalink
fix: the invalid initialization
Browse files Browse the repository at this point in the history
  • Loading branch information
under-ctrl committed Mar 24, 2020
1 parent 32aefb0 commit da4b9d6
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/components/Header/Header.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
import React, { useState, useMemo, useEffect, useCallback } from "react";
import React, {
useState,
useMemo,
useEffect,
useCallback,
useLayoutEffect,
} from "react";
import styles from "./header.module.css";
import { Button, Selector } from "../Core";
import { notifier } from "../Core/Notification";
Expand All @@ -12,7 +18,6 @@ import { proxy, Subscription } from "../../reducers/proxyReducer";
import { ipcRenderer } from "electron";
import { useLocation } from "react-router-dom";
import { updateSubscription } from "../../utils/helper";
import { useOnMount } from "../../hooks";
import { LoadingDialog } from "../Dialogs/LoadingDialog";

const Header = () => {
Expand All @@ -26,7 +31,7 @@ const Header = () => {
const dispatch = useDispatch();

//Init app
useOnMount(() => {
useLayoutEffect(() => {
if (isUpdateSubscriptionsOnOpen) {
const updateSubscriptions = async () => {
await Promise.all(
Expand Down Expand Up @@ -74,7 +79,8 @@ const Header = () => {
return () => {
ipcRenderer.removeAllListeners("message");
};
});
//Only be fired once to init app.
}, []);
const customizedRulesDirPath = useSelector<AppState, string>(
(state) => state.setting.rule.dirPath
);
Expand Down

0 comments on commit da4b9d6

Please sign in to comment.