Skip to content

Commit

Permalink
Move type ThunkFunction to src/store.ts
Browse files Browse the repository at this point in the history
Moving in preparation for using this type for the measurements
thunk functions as well.

I had considered adding a new `src/actions/types.ts` file, but that
will be confusing with the action types in `src/actions/types.js`.
  • Loading branch information
joverlee521 committed Dec 6, 2024
1 parent d1e5bc1 commit 4eb9c3c
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
5 changes: 1 addition & 4 deletions src/actions/tree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,14 @@ import { warningNotification } from "./notifications";
import { calcFullTipCounts, calcTipCounts } from "../util/treeCountingHelpers";
import { PhyloNode } from "../components/tree/phyloTree/types";
import { Metadata } from "../metadata";
import { AppDispatch, RootState } from "../store";
import { ThunkFunction } from "../store";
import { ReduxNode, TreeState } from "../reducers/tree/types";

type RootIndex = number | undefined

/** [root idx tree1, root idx tree2] */
export type Root = [RootIndex, RootIndex]

/** A function to be handled by redux (thunk) */
type ThunkFunction = (dispatch: AppDispatch, getState: () => RootState) => void

/**
* Updates the `inView` property of nodes which depends on the currently selected
* root index (i.e. what node the tree is zoomed into).
Expand Down
3 changes: 3 additions & 0 deletions src/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,7 @@ if (process.env.NODE_ENV !== 'production' && module.hot) {
export type RootState = ReturnType<typeof store.getState>
export type AppDispatch = typeof store.dispatch

/** A function to be handled by redux (thunk) */
export type ThunkFunction = (dispatch: AppDispatch, getState: () => RootState) => void

export default store;

0 comments on commit 4eb9c3c

Please sign in to comment.