From 9aa4ebce6f57c045a7b92d8871cbcb57f2e00709 Mon Sep 17 00:00:00 2001
From: Finnian Jacobson-Schulte
<140328381+finnian0826@users.noreply.github.com>
Date: Sat, 7 Dec 2024 10:36:13 +1300
Subject: [PATCH] chore(cleanup): Remove show_get_started feature gate (#6300)
### Description
Title
### Test plan
CI
### Related issues
- Part of ACT-1443
### Backwards compatibility
Yes
### Network scalability
If a new NetworkId and/or Network are added in the future, the changes
in this PR will:
- N/A
---
src/statsig/types.ts | 1 -
.../feed/TransactionFeed.test.tsx | 31 +-------------
src/transactions/feed/TransactionFeed.tsx | 7 +---
.../feed/TransactionFeedV2.test.tsx | 41 ++-----------------
src/transactions/feed/TransactionFeedV2.tsx | 5 +--
5 files changed, 7 insertions(+), 78 deletions(-)
diff --git a/src/statsig/types.ts b/src/statsig/types.ts
index 028731d8d81..5b559289602 100644
--- a/src/statsig/types.ts
+++ b/src/statsig/types.ts
@@ -22,7 +22,6 @@ export enum StatsigFeatureGates {
APP_REVIEW = 'app_review',
SHOW_IMPORT_TOKENS_FLOW = 'show_import_tokens_flow',
SAVE_CONTACTS = 'save_contacts',
- SHOW_GET_STARTED = 'show_get_started',
CLEVERTAP_INBOX = 'clevertap_inbox',
SHOW_SWAP_TOKEN_FILTERS = 'show_swap_token_filters',
SHUFFLE_SWAP_TOKENS_ORDER = 'shuffle_swap_tokens_order',
diff --git a/src/transactions/feed/TransactionFeed.test.tsx b/src/transactions/feed/TransactionFeed.test.tsx
index 1aa5d7b1ded..77dc32b413f 100644
--- a/src/transactions/feed/TransactionFeed.test.tsx
+++ b/src/transactions/feed/TransactionFeed.test.tsx
@@ -271,22 +271,6 @@ describe('TransactionFeed', () => {
expect(items.length).toBe(1)
})
- it('renders the loading indicator while it loads', async () => {
- const { getByTestId, queryByTestId } = renderScreen({})
- expect(getByTestId('NoActivity/loading')).toBeDefined()
- expect(queryByTestId('NoActivity/error')).toBeNull()
- expect(queryByTestId('TransactionList')).toBeNull()
- })
-
- it("renders an error screen if there's no cache and the query fails", async () => {
- mockFetch.mockReject(new Error('Test error'))
-
- const { getByTestId, queryByTestId } = renderScreen({})
- await waitFor(() => getByTestId('NoActivity/error'))
- expect(queryByTestId('NoActivity/loading')).toBeNull()
- expect(queryByTestId('TransactionList')).toBeNull()
- })
-
it('renders the cache if there is one', async () => {
mockFetch.mockReject(new Error('Test error'))
@@ -433,11 +417,8 @@ describe('TransactionFeed', () => {
expect(getNumTransactionItems(tree.getByTestId('TransactionList'))).toBe(11)
})
- it('renders GetStarted if SHOW_GET_STARTED is enabled and transaction feed is empty', async () => {
+ it('renders GetStarted if transaction feed is empty', async () => {
jest.mocked(getFeatureGate).mockImplementation((gate) => {
- if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
- return true
- }
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return false
}
@@ -450,9 +431,6 @@ describe('TransactionFeed', () => {
it('renders NoActivity for UK compliance', () => {
jest.mocked(getFeatureGate).mockImplementation((gate) => {
- if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
- return true
- }
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return true
}
@@ -464,11 +442,4 @@ describe('TransactionFeed', () => {
expect(getByTestId('NoActivity/loading')).toBeTruthy()
expect(getByText('transactionFeed.noTransactions')).toBeTruthy()
})
-
- it('renders NoActivity by default if transaction feed is empty', async () => {
- jest.mocked(getFeatureGate).mockReturnValue(false)
- const { getByTestId, getByText } = renderScreen({})
- expect(getByTestId('NoActivity/loading')).toBeDefined()
- expect(getByText('transactionFeed.noTransactions')).toBeTruthy()
- })
})
diff --git a/src/transactions/feed/TransactionFeed.tsx b/src/transactions/feed/TransactionFeed.tsx
index b388c912795..17b82e0ae10 100644
--- a/src/transactions/feed/TransactionFeed.tsx
+++ b/src/transactions/feed/TransactionFeed.tsx
@@ -33,7 +33,6 @@ function TransactionFeed() {
const allConfirmedStandbyTransactions = useSelector(confirmedStandbyTransactionsSelector)
const allowedNetworks = useAllowedNetworkIdsForTransfers()
- const showGetStarted = getFeatureGate(StatsigFeatureGates.SHOW_GET_STARTED)
const showUKCompliantVariant = getFeatureGate(StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT)
const confirmedFeedTransactions = useMemo(() => {
@@ -123,11 +122,7 @@ function TransactionFeed() {
}
if (!sections.length) {
- return showGetStarted && !showUKCompliantVariant ? (
-
- ) : (
-
- )
+ return !showUKCompliantVariant ? :
}
return (
diff --git a/src/transactions/feed/TransactionFeedV2.test.tsx b/src/transactions/feed/TransactionFeedV2.test.tsx
index 7f507e4ae79..88c67bfff84 100644
--- a/src/transactions/feed/TransactionFeedV2.test.tsx
+++ b/src/transactions/feed/TransactionFeedV2.test.tsx
@@ -5,7 +5,7 @@ import React from 'react'
import { Provider } from 'react-redux'
import { type ReactTestInstance } from 'react-test-renderer'
import AppAnalytics from 'src/analytics/AppAnalytics'
-import { SwapEvents } from 'src/analytics/Events'
+import { FiatExchangeEvents, SwapEvents } from 'src/analytics/Events'
import { type ApiReducersKeys } from 'src/redux/apiReducersList'
import { type RootState } from 'src/redux/reducers'
import { reducersList } from 'src/redux/reducersList'
@@ -149,19 +149,6 @@ describe('TransactionFeedV2', () => {
expect(tree.getByTestId('TransactionList').props.data).toHaveLength(0)
})
- it("renders no transactions and an error message if there's no cache and the query fails", async () => {
- mockFetch.mockReject(new Error('Test error'))
- const tree = renderScreen()
-
- expect(tree.queryByText('transactionFeed.error.fetchError')).toBeFalsy()
- expect(tree.getByTestId('TransactionList/loading')).toBeTruthy()
-
- await waitFor(() => expect(tree.getByText('transactionFeed.error.fetchError')).toBeTruthy())
- expect(tree.queryByTestId('TransactionList/loading')).toBeNull()
- expect(tree.getByText('transactionFeed.noTransactions')).toBeTruthy()
- expect(tree.getByTestId('TransactionList').props.data).toHaveLength(0)
- })
-
it('renders correctly when there are confirmed transactions and stand by transactions', async () => {
mockFetch.mockResponse(typedResponse({ transactions: [mockTransaction()] }))
@@ -236,22 +223,13 @@ describe('TransactionFeedV2', () => {
expect(tree.getByText('transactionFeed.allTransactionsShown')).toBeTruthy()
})
- it('renders GetStarted if SHOW_GET_STARTED is enabled and transaction feed is empty', async () => {
+ it('renders GetStarted if transaction feed is empty', async () => {
mockFetch.mockResponse(
typedResponse({
transactions: [],
pageInfo: { hasNextPage: false, endCursor: '', hasPreviousPage: false, startCursor: '' },
})
)
- jest.mocked(getFeatureGate).mockImplementation((gate) => {
- if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
- return true
- }
- if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
- return false
- }
- throw new Error('Unexpected gate')
- })
const tree = renderScreen()
@@ -263,9 +241,6 @@ describe('TransactionFeedV2', () => {
it('renders NoActivity for UK compliance', () => {
mockFetch.mockResponse(typedResponse({ transactions: [] }))
jest.mocked(getFeatureGate).mockImplementation((gate) => {
- if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
- return true
- }
if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
return true
}
@@ -280,15 +255,6 @@ describe('TransactionFeedV2', () => {
it('renders GetStarted with an error if the initial fetch fails', async () => {
mockFetch.mockReject(new Error('test error'))
- jest.mocked(getFeatureGate).mockImplementation((gate) => {
- if (gate === StatsigFeatureGates.SHOW_GET_STARTED) {
- return true
- }
- if (gate === StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT) {
- return false
- }
- throw new Error('Unexpected gate')
- })
const tree = renderScreen()
expect(tree.getByTestId('GetStarted')).toBeTruthy()
@@ -597,7 +563,8 @@ describe('TransactionFeedV2', () => {
crossChainFeeAmount: '0.5',
crossChainFeeAmountUsd: 500,
})
- expect(AppAnalytics.track).toBeCalledTimes(1)
+ expect(AppAnalytics.track).toBeCalledWith(FiatExchangeEvents.cico_add_get_started_impression)
+ expect(AppAnalytics.track).toBeCalledTimes(2)
})
it('should pre-populate persisted first page of the feed', async () => {
diff --git a/src/transactions/feed/TransactionFeedV2.tsx b/src/transactions/feed/TransactionFeedV2.tsx
index a1e0d07b016..e97affa562e 100644
--- a/src/transactions/feed/TransactionFeedV2.tsx
+++ b/src/transactions/feed/TransactionFeedV2.tsx
@@ -306,7 +306,6 @@ export default function TransactionFeedV2() {
const { t } = useTranslation()
const dispatch = useDispatch()
- const showGetStarted = getFeatureGate(StatsigFeatureGates.SHOW_GET_STARTED)
const showUKCompliantVariant = getFeatureGate(StatsigFeatureGates.SHOW_UK_COMPLIANT_VARIANT)
const allowedNetworkForTransfers = useAllowedNetworksForTransfers()
@@ -518,9 +517,7 @@ export default function TransactionFeedV2() {
>
}
- ListEmptyComponent={
- showGetStarted && !showUKCompliantVariant ? :
- }
+ ListEmptyComponent={!showUKCompliantVariant ? : }
ListFooterComponent={
<>
{/* prevent loading indicator due to polling from showing at the bottom of the screen */}