Skip to content

Commit 448e37e

Browse files
committed
feat: sort supporters
Signed-off-by: Sebastian Beltran <bjohansebas@gmail.com>
1 parent 21655fa commit 448e37e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

apps/site/next-data/generators/supportersData.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import {
33
GITHUB_GRAPHQL_URL,
44
GITHUB_API_KEY,
55
} from '#site/next.constants.mjs';
6+
import { shuffle } from '#site/util/array';
67
import { fetchWithRetry } from '#site/util/fetch';
78

89
/**
@@ -200,12 +201,17 @@ const graphql = async (query, variables = {}) => {
200201
* @returns {Promise<Array<import('#site/types/supporters').OpenCollectiveSupporter | import('#site/types/supporters').GithubSponsorSupporter>>} Array of supporters
201202
*/
202203
async function sponsorsData() {
204+
const seconds = 300; // Change every 5 minutes
205+
const seed = Math.floor(Date.now() / (seconds * 1000));
206+
203207
const sponsors = await Promise.all([
204208
fetchGithubSponsorsData(),
205209
fetchOpenCollectiveData(),
206210
]);
207211

208-
return sponsors.flat();
212+
const shuffled = await shuffle(sponsors.flat(), seed);
213+
214+
return shuffled;
209215
}
210216

211217
export default sponsorsData;

0 commit comments

Comments
 (0)