Skip to content

Commit

Permalink
Disable abilities extension-wide
Browse files Browse the repository at this point in the history
Due to the way that abilities are currently implemented, load on the
Daylight API side is very high. We don't have the cycles right now to
implement the underlying changes that would improve API load, so for now
we disable abilities fetching, as well as access to abilities in the UI.

The code that is commented out is targeted to only remove the parts that
link to the abilities UI and the parts that call out to the Daylight
API; the rest remains in place so that turning things back on once the
fetching strategy can be improved is straightforward.
  • Loading branch information
Shadowfiend committed Feb 16, 2024
1 parent 8e74e16 commit 4e0e2ef
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 13 deletions.
11 changes: 10 additions & 1 deletion background/services/abilities/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
createSpamReport,
DaylightAbility,
DaylightAbilityRequirement,
getDaylightAbilities,
// getDaylightAbilities,
} from "../../lib/daylight"
import { AbilitiesDatabase, getOrCreateDB } from "./db"
import ChainService from "../chain"
Expand Down Expand Up @@ -149,7 +149,15 @@ export default class AbilitiesService extends BaseService<Events> {
return this.db.getSortedAbilities()
}

// Re-enable once polling is re-enabled.
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
async pollForAbilities(address: NormalizedEVMAddress): Promise<void> {
// FIXME Disabled due to high usage on the Daylight side. UI should also be
// FIXME disconnected. Re-enabling should involve reconsidering our
// FIXME fetch/sync strategy to be based on user access/usage or other
// FIXME triggers, or be aggressively throttled when there is no direct
// FIXME user interaction.
/*
const latestDaylightAbilities = await getDaylightAbilities(address)
const latestAbilities = normalizeDaylightAbilities(
latestDaylightAbilities,
Expand All @@ -162,6 +170,7 @@ export default class AbilitiesService extends BaseService<Events> {
address,
abilities: updatedAbilities,
})
*/
}

async markAbilityAsCompleted(
Expand Down
17 changes: 9 additions & 8 deletions ui/components/Overview/AbilitiesHeader.tsx
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
import { toggleHideDescription } from "@tallyho/tally-background/redux-slices/abilities"
/* import { toggleHideDescription } from "@tallyho/tally-background/redux-slices/abilities"
import {
selectDescriptionHidden,
selectOpenAbilityCount,
} from "@tallyho/tally-background/redux-slices/selectors"
import classNames from "classnames"
import React, { ReactElement } from "react"
import React , { ReactElement } from "react"
import { useTranslation } from "react-i18next"
import { useSelector } from "react-redux"
import { useHistory } from "react-router-dom"
import { useBackgroundDispatch } from "../../hooks"
import SharedButton from "../Shared/SharedButton"
import SharedButton from "../Shared/SharedButton" */

export default function AbilitiesHeader(): ReactElement {
const { t } = useTranslation("translation", {
export default function AbilitiesHeader(): null /* ReactElement */ {
/* const { t } = useTranslation("translation", {
keyPrefix: "abilities",
})
const openAbilities = useSelector(selectOpenAbilityCount)
Expand All @@ -36,9 +36,10 @@ export default function AbilitiesHeader(): ReactElement {
if (e.key === "Enter") {
handleClick()
}
}
} */

return (
return null
/* return (
<div
className={classNames("abilities_header", {
small_banner: hideDescription,
Expand Down Expand Up @@ -198,5 +199,5 @@ export default function AbilitiesHeader(): ReactElement {
}
`}</style>
</div>
)
) */
}
10 changes: 6 additions & 4 deletions ui/components/TabBar/TabBar.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import React, { ReactElement, useCallback } from "react"
import { matchPath, useHistory, useLocation } from "react-router-dom"
import {
selectCurrentNetwork,
selectOpenAbilityCount,
// selectOpenAbilityCount,
} from "@tallyho/tally-background/redux-slices/selectors"
import { NETWORKS_SUPPORTING_SWAPS } from "@tallyho/tally-background/constants/networks"
import { EVMNetwork } from "@tallyho/tally-background/networks"
Expand All @@ -24,7 +24,7 @@ const isTabSupportedByNetwork = (tab: TabInfo, network: EVMNetwork) => {
export default function TabBar(): ReactElement {
const location = useLocation()
const selectedNetwork = useBackgroundSelector(selectCurrentNetwork)
const abilityCount = useBackgroundSelector(selectOpenAbilityCount)
// const abilityCount = useBackgroundSelector(selectOpenAbilityCount)

const history = useHistory()
const { t } = useTranslation()
Expand All @@ -42,12 +42,14 @@ export default function TabBar(): ReactElement {
(path: string): boolean => {
switch (path) {
case "/portfolio":
return abilityCount > 0
return false // abilityCount > 0
default:
return false
}
},
[abilityCount],
[
/* abilityCount */
],
)

return (
Expand Down

0 comments on commit 4e0e2ef

Please sign in to comment.