Skip to content

Conversation

@thedarkcolour
Copy link

Closes #4661

This fixes the Personal access tokens list under Settings > Personal Access Tokens to display the PATs in order of creation, instead of being in a random order every page load.

@IMB11 IMB11 enabled auto-merge October 29, 2025 12:09
@Prospector
Copy link
Member

please run pnpm fix:frontend to fix the lint issues

@Prospector
Copy link
Member

oh actually, this is failing because the computed has a side effect because .sort() mutates the original array

const { data: pats, refresh } = await useAsyncData('pat', () => useBaseFetch('pat'))
const displayPats = computed(() => {
return pats.value.sort((a, b) => new Date(b.created) - new Date(a.created))
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sort mutates pats array, computeds shouldn't have side effects like that

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, you're right, I forgot sort mutated the array instead of copying it

@Prospector Prospector added website Relates to Modrinth.com web frontend frontend Involves work from the frontend team labels Oct 29, 2025
auto-merge was automatically disabled October 30, 2025 03:54

Head branch was pushed to by a user without write access

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend Involves work from the frontend team website Relates to Modrinth.com web frontend

Development

Successfully merging this pull request may close these issues.

PATs are displayed in random order on the PATs screen

3 participants