Compare commits

..

3 Commits

Author SHA1 Message Date
github-actions[bot]
60bcd8f949 chore: update versions (#2793)
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @nhost/apollo@7.1.3

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost/react-apollo@12.0.3

### Patch Changes

-   @nhost/apollo@7.1.3
-   @nhost/react@3.5.3

## @nhost/react-urql@9.0.3

### Patch Changes

-   @nhost/react@3.5.3

## @nhost/hasura-auth-js@2.5.3

### Patch Changes

- e28975d: fix: refactor refreshTimer logic to avoid an infinite loop
when refreshToken has expired

## @nhost/nextjs@2.1.17

### Patch Changes

-   @nhost/react@3.5.3

## @nhost/nhost-js@3.1.6

### Patch Changes

-   Updated dependencies [e28975d]
    -   @nhost/hasura-auth-js@2.5.3

## @nhost/react@3.5.3

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost/vue@2.6.3

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost/dashboard@1.23.0

### Minor Changes

-   33284d3: fix: don't show double scrollbar in configuration editor

### Patch Changes

-   @nhost/react-apollo@12.0.3
-   @nhost/nextjs@2.1.17

## @nhost-examples/cli@0.3.8

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost-examples/codegen-react-apollo@0.4.8

### Patch Changes

-   @nhost/react@3.5.3
-   @nhost/react-apollo@12.0.3

## @nhost-examples/codegen-react-query@0.4.8

### Patch Changes

-   @nhost/react@3.5.3

## @nhost-examples/codegen-react-urql@0.3.8

### Patch Changes

-   @nhost/react@3.5.3
-   @nhost/react-urql@9.0.3

## @nhost-examples/multi-tenant-one-to-many@2.2.8

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost-examples/nextjs@0.3.8

### Patch Changes

-   @nhost/react@3.5.3
-   @nhost/react-apollo@12.0.3
-   @nhost/nextjs@2.1.17

## @nhost-examples/node-storage@0.2.8

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost-examples/nextjs-server-components@0.4.9

### Patch Changes

-   @nhost/nhost-js@3.1.6

## @nhost-examples/react-apollo@0.8.9

### Patch Changes

-   @nhost/react@3.5.3
-   @nhost/react-apollo@12.0.3

## @nhost-examples/react-gqty@1.2.8

### Patch Changes

-   @nhost/react@3.5.3

## @nhost-examples/react-native@0.0.2

### Patch Changes

-   @nhost/react@3.5.3
-   @nhost/react-apollo@12.0.3

## @nhost-examples/vue-apollo@0.6.8

### Patch Changes

-   @nhost/nhost-js@3.1.6
-   @nhost/apollo@7.1.3
-   @nhost/vue@2.6.3

## @nhost-examples/vue-quickstart@0.2.8

### Patch Changes

-   @nhost/apollo@7.1.3
-   @nhost/vue@2.6.3

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-07-09 10:08:51 +01:00
Hassan Ben Jobrane
e28975d6a5 fix(hasura-auth-js): refactor refreshTimer logic to avoid an infinite loop when refreshToken has expired (#2790)
### **User description**
fixes https://github.com/nhost/nhost/issues/2763
related https://github.com/nhost/nhost/issues/2635


___

### **PR Type**
Bug fix, Enhancement


___

### **Description**
- Refactored the `refreshTimer` logic in `createAuthMachine` to avoid an
infinite loop when the `refreshToken` has expired.
- Moved the condition checking if `expiresAt` is less than the current
time to ensure proper token refresh handling.
- Added a changeset file to document the patch update.



___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant
files</th></tr></thead><tbody><tr><td><strong>Bug
fix</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>machine.ts</strong><dd><code>Refactor refreshTimer
logic to prevent infinite loop</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
</dd></summary>
<hr>

packages/hasura-auth-js/src/machines/authentication/machine.ts

<li>Refactored the <code>refreshTimer</code> logic to avoid an infinite
loop when the <br><code>refreshToken</code> has expired.<br> <li> Moved
the condition checking if <code>expiresAt</code> is less than the
current <br>time.<br>


</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2790/files#diff-a8fdfee087ad5a72ea0a64667e2a0c7f25baa84eaaf73ebfee3f5a5a1b7584d1">+6/-5</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr><tr><td><strong>Documentation</strong></td><td><table>
<tr>
  <td>
    <details>
<summary><strong>small-trees-approve.md</strong><dd><code>Add changeset
for refreshTimer logic fix</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; </dd></summary>
<hr>

.changeset/small-trees-approve.md

- Added a changeset file for the patch update.



</details>


  </td>
<td><a
href="https://github.com/nhost/nhost/pull/2790/files#diff-06ccc6de28f6ef2f9423d71e83294d5b3d6fdf5f6ca6c2a3a34dfeb9e2affffd">+5/-0</a>&nbsp;
&nbsp; &nbsp; </td>

</tr>                    
</table></td></tr></tr></tbody></table>

___

> 💡 **PR-Agent usage**:
>Comment `/help` on the PR to get a list of all available PR-Agent tools
and their descriptions
2024-07-09 09:56:58 +01:00
Zephyr (David B.M.)
33284d3cf0 fix (dashboard): don't show double scrollbar in configuration editor (#2792)
Fixes #2789
2024-07-08 19:15:37 +02:00
47 changed files with 224 additions and 69 deletions

View File

@@ -1,5 +1,16 @@
# @nhost/dashboard # @nhost/dashboard
## 1.23.0
### Minor Changes
- 33284d3: fix: don't show double scrollbar in configuration editor
### Patch Changes
- @nhost/react-apollo@12.0.3
- @nhost/nextjs@2.1.17
## 1.22.0 ## 1.22.0
### Minor Changes ### Minor Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/dashboard", "name": "@nhost/dashboard",
"version": "1.22.0", "version": "1.23.0",
"private": true, "private": true,
"scripts": { "scripts": {
"preinstall": "npx only-allow pnpm", "preinstall": "npx only-allow pnpm",

View File

@@ -47,46 +47,51 @@ export default function SettingsLayout({
sx={{ backgroundColor: 'background.default' }} sx={{ backgroundColor: 'background.default' }}
className="flex w-full flex-auto flex-col overflow-y-auto overflow-x-hidden" className="flex w-full flex-auto flex-col overflow-y-auto overflow-x-hidden"
> >
<RetryableErrorBoundary> <Box
<div className="flex flex-col space-y-2"> sx={{ backgroundColor: 'background.default' }}
{hasGitRepo && ( className="flex h-full flex-col"
<Alert >
severity="warning" <RetryableErrorBoundary>
className="grid grid-flow-row place-content-center gap-2" <div className="flex flex-col space-y-2">
> {hasGitRepo && (
<Text color="warning" className="text-sm "> <Alert
As you have a connected repository, make sure to synchronize severity="warning"
your changes with{' '} className="grid grid-flow-row place-content-center gap-2"
<code >
className={twMerge( <Text color="warning" className="text-sm ">
'rounded-md px-2 py-px', As you have a connected repository, make sure to synchronize
theme.palette.mode === 'dark' your changes with{' '}
? 'bg-brown text-copper' <code
: 'bg-slate-200 text-slate-700', className={twMerge(
)} 'rounded-md px-2 py-px',
> theme.palette.mode === 'dark'
nhost config pull ? 'bg-brown text-copper'
</code>{' '} : 'bg-slate-200 text-slate-700',
or they may be reverted with the next push. )}
<br /> >
If there are multiple projects linked to the same repository nhost config pull
and you only want these changes to apply to a subset of them, </code>{' '}
please check out{' '} or they may be reverted with the next push.
<a <br />
target="_blank" If there are multiple projects linked to the same repository
rel="noopener noreferrer" and you only want these changes to apply to a subset of
className="underline" them, please check out{' '}
href="https://docs.nhost.io/cli/overlays" <a
> target="_blank"
docs.nhost.io/cli/overlays rel="noopener noreferrer"
</a>{' '} className="underline"
for guidance. href="https://docs.nhost.io/cli/overlays"
</Text> >
</Alert> docs.nhost.io/cli/overlays
)} </a>{' '}
</div> for guidance.
{children} </Text>
</RetryableErrorBoundary> </Alert>
)}
</div>
{children}
</RetryableErrorBoundary>
</Box>
</Box> </Box>
</ProjectLayout> </ProjectLayout>
); );

View File

@@ -143,7 +143,7 @@ export default function TOMLEditor() {
}; };
return ( return (
<Box className="flex h-full flex-col"> <>
<Box className="flex w-full flex-col space-y-2 border-b p-4"> <Box className="flex w-full flex-col space-y-2 border-b p-4">
<Text className="font-semibold">Configuration Editor</Text> <Text className="font-semibold">Configuration Editor</Text>
</Box> </Box>
@@ -187,6 +187,6 @@ export default function TOMLEditor() {
Save Save
</Button> </Button>
</Box> </Box>
</Box> </>
); );
} }

View File

@@ -1,5 +1,11 @@
# @nhost-examples/cli # @nhost-examples/cli
## 0.3.8
### Patch Changes
- @nhost/nhost-js@3.1.6
## 0.3.7 ## 0.3.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/cli", "name": "@nhost-examples/cli",
"version": "0.3.7", "version": "0.3.8",
"main": "src/index.mjs", "main": "src/index.mjs",
"private": true, "private": true,
"scripts": { "scripts": {

View File

@@ -1,5 +1,12 @@
# @nhost-examples/codegen-react-apollo # @nhost-examples/codegen-react-apollo
## 0.4.8
### Patch Changes
- @nhost/react@3.5.3
- @nhost/react-apollo@12.0.3
## 0.4.7 ## 0.4.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/codegen-react-apollo", "name": "@nhost-examples/codegen-react-apollo",
"version": "0.4.7", "version": "0.4.8",
"private": true, "private": true,
"scripts": { "scripts": {
"codegen": "graphql-codegen", "codegen": "graphql-codegen",

View File

@@ -1,5 +1,11 @@
# @nhost-examples/codegen-react-query # @nhost-examples/codegen-react-query
## 0.4.8
### Patch Changes
- @nhost/react@3.5.3
## 0.4.7 ## 0.4.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/codegen-react-query", "name": "@nhost-examples/codegen-react-query",
"version": "0.4.7", "version": "0.4.8",
"private": true, "private": true,
"scripts": { "scripts": {
"codegen": "graphql-codegen", "codegen": "graphql-codegen",

View File

@@ -1,5 +1,12 @@
# @nhost-examples/react-urql # @nhost-examples/react-urql
## 0.3.8
### Patch Changes
- @nhost/react@3.5.3
- @nhost/react-urql@9.0.3
## 0.3.7 ## 0.3.7
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@nhost-examples/codegen-react-urql", "name": "@nhost-examples/codegen-react-urql",
"private": true, "private": true,
"version": "0.3.7", "version": "0.3.8",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "tsc && vite build", "build": "tsc && vite build",

View File

@@ -1,5 +1,11 @@
# @nhost-examples/multi-tenant-one-to-many # @nhost-examples/multi-tenant-one-to-many
## 2.2.8
### Patch Changes
- @nhost/nhost-js@3.1.6
## 2.2.7 ## 2.2.7
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@nhost-examples/multi-tenant-one-to-many", "name": "@nhost-examples/multi-tenant-one-to-many",
"private": true, "private": true,
"version": "2.2.7", "version": "2.2.8",
"description": "", "description": "",
"main": "index.js", "main": "index.js",
"scripts": {}, "scripts": {},

View File

@@ -1,5 +1,13 @@
# @nhost-examples/nextjs # @nhost-examples/nextjs
## 0.3.8
### Patch Changes
- @nhost/react@3.5.3
- @nhost/react-apollo@12.0.3
- @nhost/nextjs@2.1.17
## 0.3.7 ## 0.3.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/nextjs", "name": "@nhost-examples/nextjs",
"version": "0.3.7", "version": "0.3.8",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",

View File

@@ -1,5 +1,11 @@
# @nhost-examples/node-storage # @nhost-examples/node-storage
## 0.2.8
### Patch Changes
- @nhost/nhost-js@3.1.6
## 0.2.7 ## 0.2.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/node-storage", "name": "@nhost-examples/node-storage",
"version": "0.2.7", "version": "0.2.8",
"private": true, "private": true,
"description": "This is an example of how to use the Storage with Node.js", "description": "This is an example of how to use the Storage with Node.js",
"main": "src/index.mjs", "main": "src/index.mjs",

View File

@@ -1,5 +1,11 @@
# @nhost-examples/nextjs-server-components # @nhost-examples/nextjs-server-components
## 0.4.9
### Patch Changes
- @nhost/nhost-js@3.1.6
## 0.4.8 ## 0.4.8
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/nextjs-server-components", "name": "@nhost-examples/nextjs-server-components",
"version": "0.4.8", "version": "0.4.9",
"private": true, "private": true,
"scripts": { "scripts": {
"dev": "next dev", "dev": "next dev",

View File

@@ -1,5 +1,12 @@
# @nhost-examples/react-apollo # @nhost-examples/react-apollo
## 0.8.9
### Patch Changes
- @nhost/react@3.5.3
- @nhost/react-apollo@12.0.3
## 0.8.8 ## 0.8.8
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/react-apollo", "name": "@nhost-examples/react-apollo",
"version": "0.8.8", "version": "0.8.9",
"private": true, "private": true,
"dependencies": { "dependencies": {
"@apollo/client": "^3.9.9", "@apollo/client": "^3.9.9",

View File

@@ -1,5 +1,11 @@
# @nhost-examples/react-gqty # @nhost-examples/react-gqty
## 1.2.8
### Patch Changes
- @nhost/react@3.5.3
## 1.2.7 ## 1.2.7
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@nhost-examples/react-gqty", "name": "@nhost-examples/react-gqty",
"private": true, "private": true,
"version": "1.2.7", "version": "1.2.8",
"type": "module", "type": "module",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",

View File

@@ -0,0 +1,8 @@
# @nhost-examples/react-native
## 0.0.2
### Patch Changes
- @nhost/react@3.5.3
- @nhost/react-apollo@12.0.3

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/react-native", "name": "@nhost-examples/react-native",
"version": "0.0.1", "version": "0.0.2",
"private": true, "private": true,
"scripts": { "scripts": {
"android": "react-native run-android", "android": "react-native run-android",

View File

@@ -1,5 +1,13 @@
# @nhost-examples/vue-apollo # @nhost-examples/vue-apollo
## 0.6.8
### Patch Changes
- @nhost/nhost-js@3.1.6
- @nhost/apollo@7.1.3
- @nhost/vue@2.6.3
## 0.6.7 ## 0.6.7
### Patch Changes ### Patch Changes

View File

@@ -1,7 +1,7 @@
{ {
"name": "@nhost-examples/vue-apollo", "name": "@nhost-examples/vue-apollo",
"private": true, "private": true,
"version": "0.6.7", "version": "0.6.8",
"scripts": { "scripts": {
"dev": "vite", "dev": "vite",
"build": "vite build", "build": "vite build",

View File

@@ -1,5 +1,12 @@
# @nhost-examples/vue-quickstart # @nhost-examples/vue-quickstart
## 0.2.8
### Patch Changes
- @nhost/apollo@7.1.3
- @nhost/vue@2.6.3
## 0.2.7 ## 0.2.7
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost-examples/vue-quickstart", "name": "@nhost-examples/vue-quickstart",
"version": "0.2.7", "version": "0.2.8",
"private": true, "private": true,
"scripts": { "scripts": {
"build": "vite build", "build": "vite build",

View File

@@ -1,5 +1,11 @@
# @nhost/apollo # @nhost/apollo
## 7.1.3
### Patch Changes
- @nhost/nhost-js@3.1.6
## 7.1.2 ## 7.1.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/apollo", "name": "@nhost/apollo",
"version": "7.1.2", "version": "7.1.3",
"description": "Nhost Apollo Client library", "description": "Nhost Apollo Client library",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,12 @@
# @nhost/react-apollo # @nhost/react-apollo
## 12.0.3
### Patch Changes
- @nhost/apollo@7.1.3
- @nhost/react@3.5.3
## 12.0.2 ## 12.0.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/react-apollo", "name": "@nhost/react-apollo",
"version": "12.0.2", "version": "12.0.3",
"description": "Nhost React Apollo client", "description": "Nhost React Apollo client",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/react-urql # @nhost/react-urql
## 9.0.3
### Patch Changes
- @nhost/react@3.5.3
## 9.0.2 ## 9.0.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/react-urql", "name": "@nhost/react-urql",
"version": "9.0.2", "version": "9.0.3",
"description": "Nhost React URQL client", "description": "Nhost React URQL client",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/hasura-auth-js # @nhost/hasura-auth-js
## 2.5.3
### Patch Changes
- e28975d: fix: refactor refreshTimer logic to avoid an infinite loop when refreshToken has expired
## 2.5.2 ## 2.5.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/hasura-auth-js", "name": "@nhost/hasura-auth-js",
"version": "2.5.2", "version": "2.5.3",
"description": "Hasura-auth client", "description": "Hasura-auth client",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -697,11 +697,6 @@ export const createAuthMachine = ({
return false return false
} }
// This happens when either the computer goes to sleep or when Chrome descides to suspend the tab
if (expiresAt.getTime() < Date.now()) {
return true
}
if (ctx.refreshTimer.lastAttempt) { if (ctx.refreshTimer.lastAttempt) {
// * If the refresh timer reached the maximum number of attempts, we should not try again // * If the refresh timer reached the maximum number of attempts, we should not try again
if (ctx.refreshTimer.attempts > REFRESH_TOKEN_MAX_ATTEMPTS) { if (ctx.refreshTimer.attempts > REFRESH_TOKEN_MAX_ATTEMPTS) {
@@ -711,6 +706,12 @@ export const createAuthMachine = ({
// * Exponential backoff // * Exponential backoff
return elapsed > Math.pow(2, ctx.refreshTimer.attempts - 1) * 5_000 return elapsed > Math.pow(2, ctx.refreshTimer.attempts - 1) * 5_000
} }
// This happens when either the computer goes to sleep or when Chrome descides to suspend the tab
if (expiresAt.getTime() < Date.now()) {
return true
}
if (refreshIntervalTime) { if (refreshIntervalTime) {
// * If a refreshIntervalTime has been passed on as an option, it will notify // * If a refreshIntervalTime has been passed on as an option, it will notify
// * the token should be refershed when this interval is overdue // * the token should be refershed when this interval is overdue

View File

@@ -1,5 +1,11 @@
# @nhost/nextjs # @nhost/nextjs
## 2.1.17
### Patch Changes
- @nhost/react@3.5.3
## 2.1.16 ## 2.1.16
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/nextjs", "name": "@nhost/nextjs",
"version": "2.1.16", "version": "2.1.17",
"description": "Nhost NextJS library", "description": "Nhost NextJS library",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,12 @@
# @nhost/nhost-js # @nhost/nhost-js
## 3.1.6
### Patch Changes
- Updated dependencies [e28975d]
- @nhost/hasura-auth-js@2.5.3
## 3.1.5 ## 3.1.5
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/nhost-js", "name": "@nhost/nhost-js",
"version": "3.1.5", "version": "3.1.6",
"description": "Nhost JavaScript SDK", "description": "Nhost JavaScript SDK",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/react # @nhost/react
## 3.5.3
### Patch Changes
- @nhost/nhost-js@3.1.6
## 3.5.2 ## 3.5.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/react", "name": "@nhost/react",
"version": "3.5.2", "version": "3.5.3",
"description": "Nhost React library", "description": "Nhost React library",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [

View File

@@ -1,5 +1,11 @@
# @nhost/vue # @nhost/vue
## 2.6.3
### Patch Changes
- @nhost/nhost-js@3.1.6
## 2.6.2 ## 2.6.2
### Patch Changes ### Patch Changes

View File

@@ -1,6 +1,6 @@
{ {
"name": "@nhost/vue", "name": "@nhost/vue",
"version": "2.6.2", "version": "2.6.3",
"description": "Nhost Vue library", "description": "Nhost Vue library",
"license": "MIT", "license": "MIT",
"keywords": [ "keywords": [