use getState for actions

This commit is contained in:
tjs 2023-01-03 17:20:00 -05:00
parent 4ec7f74466
commit 5e0492d0a6
14 changed files with 15 additions and 15 deletions

View File

@ -22,7 +22,7 @@ const MangoAccountsList = ({
}) => {
const { t } = useTranslation('common')
const mangoAccounts = mangoStore((s) => s.mangoAccounts)
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const loading = mangoStore((s) => s.mangoAccount.initialLoad)
const [showNewAccountModal, setShowNewAccountModal] = useState(false)
const [, setLastAccountViewed] = useLocalStorageStringState(LAST_ACCOUNT_KEY)

View File

@ -25,7 +25,7 @@ const AccountChart = ({
yKey: string
}) => {
const { t } = useTranslation('common')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const [daysToShow, setDaysToShow] = useState<string>('1')
const loading = mangoStore((s) => s.mangoAccount.stats.performance.loading)

View File

@ -57,7 +57,7 @@ const AccountPage = () => {
// const { connected } = useWallet()
const group = mangoStore.getState().group
const { mangoAccount } = useMangoAccount()
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const loadPerformanceData = mangoStore(
(s) => s.mangoAccount.stats.performance.loading
)

View File

@ -68,7 +68,7 @@ const DEFAULT_PARAMS = [
const ActivityFeed = () => {
const activityFeed = mangoStore((s) => s.activityFeed.feed)
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const { mangoAccount } = useMangoAccount()
const [showActivityDetail, setShowActivityDetail] = useState(null)
const [filters, setFilters] = useState<Filters>(DEFAULT_FILTERS)
@ -162,7 +162,7 @@ const ActivityFilters = ({
setAdvancedFilters: (x: AdvancedFilters) => void
}) => {
const { t } = useTranslation(['common', 'activity'])
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const loadActivityFeed = mangoStore((s) => s.activityFeed.loading)
const { mangoAccount } = useMangoAccount()
const [showMobileFilters, setShowMobileFilters] = useState(false)

View File

@ -33,7 +33,7 @@ const ActivityFeedTable = ({
}) => {
const { t } = useTranslation(['common', 'activity'])
const { mangoAccount } = useMangoAccount()
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const loadActivityFeed = mangoStore((s) => s.activityFeed.loading)
const [offset, setOffset] = useState(0)
const [preferredExplorer] = useLocalStorageState(

View File

@ -26,7 +26,7 @@ const EditNftProfilePic = ({ onClose }: { onClose: () => void }) => {
const nftsLoading = mangoStore((s) => s.wallet.nfts.loading)
const connection = mangoStore((s) => s.connection)
const [selectedProfile, setSelectedProfile] = useState<string>('')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const profile = mangoStore((s) => s.profile.details)
useEffect(() => {

View File

@ -36,7 +36,7 @@ const EditProfileForm = ({
const [loadUniquenessCheck, setLoadUniquenessCheck] = useState(false)
const [loadUpdateProfile, setLoadUpdateProfile] = useState(false)
const [updateError, setUpdateError] = useState('')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const validateProfileNameUniqueness = async (name: string) => {
try {

View File

@ -21,7 +21,7 @@ const RPC_URLS = [
const RpcSettings = () => {
const { t } = useTranslation('settings')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const [customUrl, setCustomUrl] = useState('')
const [showCustomForm, setShowCustomForm] = useState(false)
const [rpcEndpointProvider, setRpcEndpointProvider] = useLocalStorageState(

View File

@ -15,7 +15,7 @@ const TABS =
const StatsPage = () => {
const [activeTab, setActiveTab] = useState('tokens')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const { group } = useMangoGroup()
useEffect(() => {

View File

@ -22,7 +22,7 @@ import mangoStore from '@store/mangoStore'
const TokenStats = () => {
const { t } = useTranslation(['common', 'token'])
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const initialStatsLoad = mangoStore((s) => s.tokenStats.initialLoad)
const [showTokenDetails, setShowTokenDetails] = useState('')
const { group } = useMangoGroup()

View File

@ -40,7 +40,7 @@ const SwapHistoryTable = ({
const { connected } = useWallet()
const { mangoTokens } = useJupiterMints()
const [showSwapDetails, setSwapDetails] = useState('')
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const { mangoAccount } = useMangoAccount()
const { width } = useViewport()
const showTableView = width ? width > breakpoints.md : false

View File

@ -16,7 +16,7 @@ const ChartTabs = ({ token }: { token: string }) => {
const tokenStats = mangoStore((s) => s.tokenStats.data)
const initialStatsLoad = mangoStore((s) => s.tokenStats.initialLoad)
const loadingTokenStats = mangoStore((s) => s.tokenStats.loading)
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const { group } = useMangoGroup()
useEffect(() => {

View File

@ -17,7 +17,7 @@ const CustomTooltip = ({
const { title, description } = tourLogic!.stepContent
const { next, prev, close, allSteps, stepIndex } = tourLogic!
const { publicKey } = useWallet()
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
const tourSettings = mangoStore((s) => s.settings.tours)
const [loading, setLoading] = useState(false)

View File

@ -26,7 +26,7 @@ const ConnectedMenu = () => {
const [showMangoAccountsModal, setShowMangoAccountsModal] = useState(false)
const set = mangoStore((s) => s.set)
const actions = mangoStore((s) => s.actions)
const actions = mangoStore.getState().actions
// const profileDetails = mangoStore((s) => s.profile.details)
const loadProfileDetails = mangoStore((s) => s.profile.loadDetails)