chore: improves abort controller logic for server functions (#9131)

### What?
Removes abort controllers that were shared globally inside the server
actions provider.

### Why?
Constructing them in this way will cause different fetches using the
same function to cancel one another accidentally.

These are currently causing issues when two components call server
functions, even different functions, because the global ref inside was
being overwritten and aborting the previous one.

### How?
Standardizes how we construct and destroy abort controllers. This PR is focused around creating them to pass into the exposed serverAction provider functions. There are other places where this pattern can be applied.
This commit is contained in:
Jarrod Flesch
2024-11-12 11:20:17 -05:00
committed by GitHub
parent 7cd805adb9
commit 97cffa51f8
16 changed files with 199 additions and 241 deletions

View File

@@ -481,10 +481,8 @@ describe('access control', () => {
await expect(page.locator('.unauthorized')).toBeVisible()
await page.goto(logoutURL)
await page.waitForURL(logoutURL)
// Log back in for the next test
await page.goto(logoutURL)
await login({
data: {
email: devUser.email,
@@ -528,6 +526,19 @@ describe('access control', () => {
await page.waitForURL(unauthorizedURL)
await expect(page.locator('.unauthorized')).toBeVisible()
// Log back in for the next test
await context.clearCookies()
await page.goto(logoutURL)
await page.waitForURL(logoutURL)
await login({
data: {
email: devUser.email,
password: devUser.password,
},
page,
serverURL,
})
})
})