Skip to content

Commit d52882f

Browse files
Ishan VeerIshan Veer
authored andcommitted
added feature flag to pagination function
1 parent eb3bd0f commit d52882f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

users/discord/App.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ export const usersData = {
1515
verified: null,
1616
};
1717
const urlParams = new URLSearchParams(window.location.search);
18+
const isDev = urlParams.get('dev') === 'true';
1819

1920
let activeTab = urlParams.get('tab') ?? 'in_discord';
2021
const INITIAL_USERS = 10;
@@ -25,7 +26,9 @@ let showUser = 0;
2526
/* this is the original function for fetching user data from the API, will remove it once
2627
the API pagination issue is resolved. Currently testing pagination using mock data.
2728
*/
29+
2830
// usersData[activeTab] = await getUsers(activeTab);
31+
2932
// add feature flag(feature should be only visible when query params dev=true)
3033

3134
export const paginateFetchedUsers = async (tabId, page = 1) => {
@@ -53,6 +56,7 @@ export const paginateFetchedUsers = async (tabId, page = 1) => {
5356
usersData[tabId] = [...usersData[tabId], ...uniqueNewUsers];
5457
}
5558
currentPage = page;
59+
console.log(usersData[tabId]);
5660
}
5761
} catch (error) {
5862
console.error('Error fetching users', error);
@@ -114,5 +118,6 @@ export const App = () => {
114118
NoUserFound(),
115119
]);
116120
};
117-
118-
paginateFetchedUsers(activeTab, 1);
121+
if (isDev) {
122+
paginateFetchedUsers(activeTab, 1);
123+
}

0 commit comments

Comments
 (0)