Skip to content

Commit

Permalink
Fix react state bugs (#49)
Browse files Browse the repository at this point in the history
* Fix react state bugs

* version lockfile
  • Loading branch information
dedoussis authored Jan 28, 2024
1 parent eb3db5d commit 64e72f1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 5 deletions.
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "icloud-hide-my-email-browser-extension",
"version": "1.2.2",
"version": "1.2.3",
"description": "Cross-browser extension enabling the usage of iCloud's Hide My Email service.",
"license": "MIT",
"author": "dedoussis",
Expand Down
7 changes: 6 additions & 1 deletion src/pages/Options/Options.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ import {
import { OPTIONS_STORAGE_KEYS } from '../../storage';
import { DEFAULT_OPTIONS, Options } from '../../options';
import startCase from 'lodash.startcase';
import isEqual from 'lodash.isequal';

const SelectFwdToForm = () => {
const [selectedFwdToEmail, setSelectedFwdToEmail] = useState<string>();
Expand All @@ -35,7 +36,11 @@ const SelectFwdToForm = () => {
'To select a new Forward-To address, you first need to sign-in by following the instructions on the extension pop-up.'
);
} else {
setClientState([client.webservices]);
setClientState((prevState) =>
isEqual(prevState, [client.webservices])
? prevState
: [client.webservices]
);
try {
const pms = new PremiumMailSettings(client);
const result = await pms.listHme();
Expand Down
4 changes: 3 additions & 1 deletion src/pages/Popup/Popup.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -801,7 +801,9 @@ const Popup = () => {
);
} else {
setState(PopupState.SignedOut);
setClientState([]);
setClientState((prevState) =>
prevState.length === 0 ? prevState : []
);
performDeauthSideEffects();
}
setAuthStateSynced(true);
Expand Down

0 comments on commit 64e72f1

Please sign in to comment.