Compare commits

...

4 Commits

Author SHA1 Message Date
github-actions[bot]
2c33051f83 chore: update versions (#2719)
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.1

### Patch Changes

-   @nhost/nhost-js@3.1.4

## @nhost/react-apollo@12.0.1

### Patch Changes

-   @nhost/apollo@7.1.1
-   @nhost/react@3.5.1

## @nhost/react-urql@9.0.1

### Patch Changes

-   @nhost/react@3.5.1

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

### Patch Changes

- f4f0353: fix: improve environment/browser detection to support React
Native
- defffd8: fix: resolve issue where `/token` endpoint is called with an
empty token during sign-in

## @nhost/nextjs@2.1.15

### Patch Changes

-   @nhost/react@3.5.1

## @nhost/nhost-js@3.1.4

### Patch Changes

-   Updated dependencies [f4f0353]
-   Updated dependencies [defffd8]
    -   @nhost/hasura-auth-js@2.5.1

## @nhost/react@3.5.1

### Patch Changes

-   @nhost/nhost-js@3.1.4

## @nhost/vue@2.6.1

### Patch Changes

-   @nhost/nhost-js@3.1.4

## @nhost/dashboard@1.16.2

### Patch Changes

- a9413af: fix: update `GetAllWorkspacesAndProjects` query polling to
use exponential backoff
    -   @nhost/react-apollo@12.0.1
    -   @nhost/nextjs@2.1.15

## @nhost-examples/cli@0.3.6

### Patch Changes

-   @nhost/nhost-js@3.1.4

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

### Patch Changes

-   @nhost/react@3.5.1
-   @nhost/react-apollo@12.0.1

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

### Patch Changes

-   @nhost/react@3.5.1

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

### Patch Changes

-   @nhost/react@3.5.1
-   @nhost/react-urql@9.0.1

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

### Patch Changes

-   @nhost/nhost-js@3.1.4

## @nhost-examples/nextjs@0.3.6

### Patch Changes

-   @nhost/react@3.5.1
-   @nhost/react-apollo@12.0.1
-   @nhost/nextjs@2.1.15

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

### Patch Changes

-   @nhost/nhost-js@3.1.4

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

### Patch Changes

-   @nhost/nhost-js@3.1.4

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

### Patch Changes

-   @nhost/react@3.5.1
-   @nhost/react-apollo@12.0.1

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

### Patch Changes

-   @nhost/react@3.5.1

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

### Patch Changes

-   @nhost/nhost-js@3.1.4
-   @nhost/apollo@7.1.1
-   @nhost/vue@2.6.1

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

### Patch Changes

-   @nhost/apollo@7.1.1
-   @nhost/vue@2.6.1

Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
2024-05-21 15:23:32 +01:00
Hassan Ben Jobrane
a9413af6e0 fix: update GetAllWorkspacesAndProjects query polling to use exp backoff (#2718) 2024-05-21 13:44:38 +01:00
Hassan Ben Jobrane
f4f0353f2e fix(hasura-auth-js): resolve social sign-in issue in React Native (#2716)
fix https://github.com/nhost/nhost/issues/2216
2024-05-20 19:13:13 +01:00
Hassan Ben Jobrane
defffd8bc4 fix: update internal-client to use payload.token instead of payload.token.data (#2717) 2024-05-20 19:05:21 +01:00
46 changed files with 201 additions and 44 deletions

View File

@@ -1,5 +1,13 @@
# @nhost/dashboard
## 1.16.2
### Patch Changes
- a9413af: fix: update `GetAllWorkspacesAndProjects` query polling to use exponential backoff
- @nhost/react-apollo@12.0.1
- @nhost/nextjs@2.1.15
## 1.16.1
### Patch Changes

View File

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

View File

@@ -5,7 +5,9 @@ import { useGetAnnouncementsQuery } from '@/utils/__generated__/graphql';
import formatDistance from 'date-fns/formatDistance';
export default function Announcements() {
const { data, loading, error } = useGetAnnouncementsQuery();
const { data, loading, error } = useGetAnnouncementsQuery({
fetchPolicy: 'cache-first',
});
const announcements = data?.announcements || [];

View File

@@ -7,41 +7,55 @@ import { Button } from '@/components/ui/v2/Button';
import { Text } from '@/components/ui/v2/Text';
import { WorkspaceAndProjectList } from '@/features/projects/common/components/WorkspaceAndProjectList';
import { WorkspaceSidebar } from '@/features/projects/common/components/WorkspaceSidebar';
import { useGetAllWorkspacesAndProjectsQuery } from '@/utils/__generated__/graphql';
import {
useGetAllWorkspacesAndProjectsQuery,
type GetAllWorkspacesAndProjectsQuery,
} from '@/utils/__generated__/graphql';
import { NetworkStatus } from '@apollo/client';
import { darken } from '@mui/system';
import { useUserData } from '@nhost/nextjs';
import NavLink from 'next/link';
import type { ReactElement } from 'react';
import { useEffect } from 'react';
import { useState, type ReactElement } from 'react';
export default function IndexPage() {
const user = useUserData();
const { data, loading, startPolling, stopPolling } =
const [, setPollInterval] = useState(1_000);
// keep polling for workspaces until there is a workspace available.
// We do this because when a user signs up a workspace is created automatically
// and the serverless function can take some time to complete.
const { data, startPolling, stopPolling, networkStatus } =
useGetAllWorkspacesAndProjectsQuery({
skip: !user,
notifyOnNetworkStatusChange: true,
onError: () => {
// When there's an error (graphql, network error) apply an exponential backoff strategy
setPollInterval((prevInterval) => {
const newInterval = Math.min(60_000, prevInterval * 2);
startPolling(newInterval);
return newInterval;
});
},
onCompleted: (queryData: GetAllWorkspacesAndProjectsQuery) => {
if (!queryData?.workspaces.length) {
setPollInterval(1000);
startPolling(1000);
} else {
setPollInterval(0);
stopPolling();
}
},
});
// keep showing loading indicator while polling
const loading = networkStatus === NetworkStatus.loading;
const numberOfProjects = data?.workspaces.reduce(
(projectCount, currentWorkspace) =>
projectCount + currentWorkspace.projects.length,
0,
);
// keep polling for workspaces until there is a workspace available.
// We do this because when a user signs up a workspace is created automatically
// and the serverless function can take some time to complete.
useEffect(() => {
startPolling(1000);
}, [startPolling]);
useEffect(() => {
if (!data?.workspaces.length) {
return;
}
stopPolling();
}, [data?.workspaces, stopPolling]);
if ((!data && loading) || !user) {
return <LoadingScreen />;
}

View File

@@ -1,5 +1,11 @@
# @nhost-examples/cli
## 0.3.6
### Patch Changes
- @nhost/nhost-js@3.1.4
## 0.3.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost-examples/codegen-react-apollo
## 0.4.6
### Patch Changes
- @nhost/react@3.5.1
- @nhost/react-apollo@12.0.1
## 0.4.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost-examples/codegen-react-query
## 0.4.6
### Patch Changes
- @nhost/react@3.5.1
## 0.4.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost-examples/react-urql
## 0.3.6
### Patch Changes
- @nhost/react@3.5.1
- @nhost/react-urql@9.0.1
## 0.3.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost-examples/multi-tenant-one-to-many
## 2.2.6
### Patch Changes
- @nhost/nhost-js@3.1.4
## 2.2.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,13 @@
# @nhost-examples/nextjs
## 0.3.6
### Patch Changes
- @nhost/react@3.5.1
- @nhost/react-apollo@12.0.1
- @nhost/nextjs@2.1.15
## 0.3.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost-examples/node-storage
## 0.2.6
### Patch Changes
- @nhost/nhost-js@3.1.4
## 0.2.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost-examples/nextjs-server-components
## 0.4.6
### Patch Changes
- @nhost/nhost-js@3.1.4
## 0.4.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost-examples/react-apollo
## 0.8.6
### Patch Changes
- @nhost/react@3.5.1
- @nhost/react-apollo@12.0.1
## 0.8.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost-examples/react-gqty
## 1.2.6
### Patch Changes
- @nhost/react@3.5.1
## 1.2.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,13 @@
# @nhost-examples/vue-apollo
## 0.6.6
### Patch Changes
- @nhost/nhost-js@3.1.4
- @nhost/apollo@7.1.1
- @nhost/vue@2.6.1
## 0.6.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost-examples/vue-quickstart
## 0.2.6
### Patch Changes
- @nhost/apollo@7.1.1
- @nhost/vue@2.6.1
## 0.2.5
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/apollo
## 7.1.1
### Patch Changes
- @nhost/nhost-js@3.1.4
## 7.1.0
### Minor Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost/react-apollo
## 12.0.1
### Patch Changes
- @nhost/apollo@7.1.1
- @nhost/react@3.5.1
## 12.0.0
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/react-urql
## 9.0.1
### Patch Changes
- @nhost/react@3.5.1
## 9.0.0
### Patch Changes

View File

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

View File

@@ -1,5 +1,12 @@
# @nhost/hasura-auth-js
## 2.5.1
### Patch Changes
- f4f0353: fix: improve environment/browser detection to support React Native
- defffd8: fix: resolve issue where `/token` endpoint is called with an empty token during sign-in
## 2.5.0
### Minor Changes

View File

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

View File

@@ -60,8 +60,8 @@ export class AuthClient {
if (type === 'broadcast_token') {
const existingToken = this.interpreter?.getSnapshot().context.refreshToken.value
if (this.interpreter && payload.token.data !== existingToken) {
this.interpreter.send('TRY_TOKEN', { token: payload.token.data })
if (this.interpreter && payload.token && payload.token !== existingToken) {
this.interpreter.send('TRY_TOKEN', { token: payload.token })
}
}
})

View File

@@ -1 +1,2 @@
export const isBrowser = () => typeof window !== 'undefined'
export const isBrowser = () =>
typeof window !== 'undefined' && typeof window.location !== 'undefined'

View File

@@ -1,5 +1,11 @@
# @nhost/nextjs
## 2.1.15
### Patch Changes
- @nhost/react@3.5.1
## 2.1.14
### Patch Changes

View File

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

View File

@@ -1,5 +1,13 @@
# @nhost/nhost-js
## 3.1.4
### Patch Changes
- Updated dependencies [f4f0353]
- Updated dependencies [defffd8]
- @nhost/hasura-auth-js@2.5.1
## 3.1.3
### Patch Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/react
## 3.5.1
### Patch Changes
- @nhost/nhost-js@3.1.4
## 3.5.0
### Minor Changes

View File

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

View File

@@ -1,5 +1,11 @@
# @nhost/vue
## 2.6.1
### Patch Changes
- @nhost/nhost-js@3.1.4
## 2.6.0
### Minor Changes

View File

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