Skip to content

Commit

Permalink
fix: use SetStateAction instead of StateUpdater
Browse files Browse the repository at this point in the history
  • Loading branch information
lfleischmann committed Nov 2, 2023
1 parent 8288ee5 commit b2666bf
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 22 deletions.
4 changes: 2 additions & 2 deletions frontend/elements/src/components/accordion/Accordion.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { h } from "preact";
import { StateUpdater } from "preact/compat";
import { SetStateAction } from "preact/compat";

import cx from "classnames";

Expand All @@ -12,7 +12,7 @@ interface Props<T> {
columnSelector: Selector<T>;
contentSelector: Selector<T>;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
data: Array<T>;
dropdown?: boolean;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {
StateUpdater,
SetStateAction,
useCallback,
useContext,
useMemo,
Expand All @@ -26,7 +26,7 @@ import ProfilePage from "../../pages/ProfilePage";
interface Props {
setError: (e: HankoError) => void;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const AddEmailDropdown = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StateUpdater, useContext, useState } from "preact/compat";
import { SetStateAction, useContext, useState } from "preact/compat";

import {
WebauthnSupport,
Expand All @@ -17,7 +17,7 @@ import Dropdown from "./Dropdown";
interface Props {
setError: (e: HankoError) => void;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const AddPasskeyDropdown = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { StateUpdater, useContext, useState } from "preact/compat";
import { SetStateAction, useContext, useState } from "preact/compat";

import { HankoError } from "@teamhanko/hanko-frontend-sdk";

Expand All @@ -14,7 +14,7 @@ import Dropdown from "./Dropdown";
interface Props {
setError: (e: HankoError) => void;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const ChangePasswordDropdown = ({
Expand Down
4 changes: 2 additions & 2 deletions frontend/elements/src/components/accordion/Dropdown.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { ComponentChildren, Fragment, h } from "preact";
import { StateUpdater } from "preact/compat";
import { SetStateAction } from "preact/compat";

import Accordion from "./Accordion";

Expand All @@ -8,7 +8,7 @@ interface Props {
title: string | h.JSX.Element;
children: ComponentChildren;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const Dropdown = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { Fragment } from "preact";
import {
StateUpdater,
SetStateAction,
useCallback,
useContext,
useMemo,
Expand Down Expand Up @@ -29,7 +29,7 @@ import LoginPasscodePage from "../../pages/LoginPasscodePage";
interface Props {
setError: (e: HankoError) => void;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const ListEmailsAccordion = ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Fragment } from "preact";
import { StateUpdater, useContext, useState } from "preact/compat";
import { SetStateAction, useContext, useState } from "preact/compat";

import {
HankoError,
Expand All @@ -22,7 +22,7 @@ interface Props {
credentials: WebauthnCredentials;
setError: (e: HankoError) => void;
checkedItemIndex?: number;
setCheckedItemIndex: StateUpdater<number>;
setCheckedItemIndex: SetStateAction<number>;
}

const ListPasskeysAccordion = ({
Expand Down
16 changes: 8 additions & 8 deletions frontend/elements/src/contexts/AppProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { ComponentChildren, createContext, h } from "preact";
import { TranslateProvider } from "@denysvuika/preact-translate";

import {
StateUpdater,
SetStateAction,
useState,
useCallback,
useMemo,
Expand Down Expand Up @@ -54,19 +54,19 @@ interface Props {

interface States {
config: Config;
setConfig: StateUpdater<Config>;
setConfig: SetStateAction<Config>;
userInfo: UserInfo;
setUserInfo: StateUpdater<UserInfo>;
setUserInfo: SetStateAction<UserInfo>;
passcode: Passcode;
setPasscode: StateUpdater<Passcode>;
setPasscode: SetStateAction<Passcode>;
user: User;
setUser: StateUpdater<User>;
setUser: SetStateAction<User>;
emails: Emails;
setEmails: StateUpdater<Emails>;
setEmails: SetStateAction<Emails>;
webauthnCredentials: WebauthnCredentials;
setWebauthnCredentials: StateUpdater<WebauthnCredentials>;
setWebauthnCredentials: SetStateAction<WebauthnCredentials>;
page: h.JSX.Element;
setPage: StateUpdater<h.JSX.Element>;
setPage: SetStateAction<h.JSX.Element>;
}

interface Context extends States {
Expand Down

0 comments on commit b2666bf

Please sign in to comment.