Skip to content

Commit 75ccb8e

Browse files
authored
Add skipInitialFetch option (#79)
* Add `skipInitialFetch` option * Set skipInitialFetch to true and remove from authprovider * Bump version and dependencies * Update tests with skipInitialFetch
1 parent 432ee89 commit 75ccb8e

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
"type": "git",
66
"url": "https://github.com/PropelAuth/react"
77
},
8-
"version": "2.0.31",
8+
"version": "2.0.32",
99
"license": "MIT",
1010
"keywords": [
1111
"auth",
1212
"react",
1313
"user"
1414
],
1515
"dependencies": {
16-
"@propelauth/javascript": "^2.0.22",
16+
"@propelauth/javascript": "^2.0.23",
1717
"hoist-non-react-statics": "^3.3.2",
1818
"utility-types": "^3.10.0"
1919
},

src/index.test.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -603,7 +603,7 @@ function createMockClient() {
603603
const AUTH_URL = "authUrl"
604604

605605
function expectCreateClientWasCalledCorrectly() {
606-
expect(createClient).toHaveBeenCalledWith({ authUrl: AUTH_URL, enableBackgroundTokenRefresh: true })
606+
expect(createClient).toHaveBeenCalledWith({ authUrl: AUTH_URL, enableBackgroundTokenRefresh: true, skipInitialFetch: true })
607607
}
608608

609609
function createOrg() {

src/useClientRef.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export const useClientRef = (props: UseClientRefProps) => {
1818
// Use a ref to store the client so that it doesn't get recreated on every render
1919
const clientRef = useRef<ClientRef | null>(null)
2020
if (clientRef.current === null) {
21-
const client = createClient({ authUrl, enableBackgroundTokenRefresh: true, minSecondsBeforeRefresh })
21+
const client = createClient({ authUrl, enableBackgroundTokenRefresh: true, minSecondsBeforeRefresh, skipInitialFetch: true })
2222
client.addAccessTokenChangeObserver(() => setAccessTokenChangeCounter((x) => x + 1))
2323
clientRef.current = { authUrl, client }
2424
}
@@ -32,7 +32,7 @@ export const useClientRef = (props: UseClientRefProps) => {
3232
} else {
3333
clientRef.current.client.destroy()
3434

35-
const newClient = createClient({ authUrl, enableBackgroundTokenRefresh: true, minSecondsBeforeRefresh })
35+
const newClient = createClient({ authUrl, enableBackgroundTokenRefresh: true, minSecondsBeforeRefresh, skipInitialFetch: true })
3636
newClient.addAccessTokenChangeObserver(() => setAccessTokenChangeCounter((x) => x + 1))
3737
clientRef.current = { authUrl, client: newClient }
3838
}

0 commit comments

Comments
 (0)