Compare commits
7 Commits
@nhost/das
...
@nhost/das
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
378a6684b0 | ||
|
|
1999ae09e6 | ||
|
|
0fe48a0833 | ||
|
|
52ccfdec89 | ||
|
|
8956d47bce | ||
|
|
dd0738d5f7 | ||
|
|
11d77d6011 |
@@ -1,5 +1,11 @@
|
||||
# @nhost/dashboard
|
||||
|
||||
## 0.7.13
|
||||
|
||||
### Patch Changes
|
||||
|
||||
- dd0738d5: fix(dashboard): provisioning status polling
|
||||
|
||||
## 0.7.12
|
||||
|
||||
### Patch Changes
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@nhost/dashboard",
|
||||
"version": "0.7.12",
|
||||
"version": "0.7.13",
|
||||
"private": true,
|
||||
"scripts": {
|
||||
"preinstall": "npx only-allow pnpm",
|
||||
@@ -17,7 +17,7 @@
|
||||
"build-storybook": "build-storybook"
|
||||
},
|
||||
"dependencies": {
|
||||
"@apollo/client": "^3.6.2",
|
||||
"@apollo/client": "^3.7.3",
|
||||
"@codemirror/language": "^6.3.0",
|
||||
"@emotion/cache": "^11.10.5",
|
||||
"@emotion/react": "^11.10.5",
|
||||
|
||||
@@ -32,9 +32,12 @@ export default function ConnectGithubModal({ close }: ConnectGithubModalProps) {
|
||||
useState<ConnectGithubModalState>('CONNECTING');
|
||||
const [selectedRepoId, setSelectedRepoId] = useState<string | null>(null);
|
||||
|
||||
const { data, loading, error } = useGetGithubRepositoriesQuery({
|
||||
pollInterval: 2000,
|
||||
});
|
||||
const { data, loading, error, startPolling } =
|
||||
useGetGithubRepositoriesQuery();
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(2000);
|
||||
}, [startPolling]);
|
||||
|
||||
const handleSelectAnotherRepository = () => {
|
||||
setSelectedRepoId(null);
|
||||
|
||||
@@ -13,14 +13,17 @@ export function FunctionsLogsTerminalPage({ functionName }: any) {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const [normalizedFunctionData, setNormalizedFunctionData] = useState(null);
|
||||
|
||||
const { data } = useGetFunctionLogQuery({
|
||||
const { data, startPolling } = useGetFunctionLogQuery({
|
||||
variables: {
|
||||
subdomain: currentApplication.subdomain,
|
||||
functionPaths: [functionName?.split('/').slice(1, 3).join('/')],
|
||||
},
|
||||
pollInterval: 3000,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(3000);
|
||||
}, [startPolling]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data || data.getFunctionLogs.length === 0) {
|
||||
return;
|
||||
|
||||
@@ -9,6 +9,7 @@ import { updateOwnCache } from '@/utils/updateOwnCache';
|
||||
import { useApolloClient } from '@apollo/client';
|
||||
import { useUserData } from '@nhost/nextjs';
|
||||
import { useRouter } from 'next/router';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export function InviteAnnounce() {
|
||||
const user = useUserData();
|
||||
@@ -21,15 +22,18 @@ export function InviteAnnounce() {
|
||||
useSubmitState();
|
||||
|
||||
// @FIX: We probably don't want to poll every ten seconds for possible invites. (We can change later depending on how it works in production.) Maybe just on the workspace page?
|
||||
const { data, loading, error, refetch } =
|
||||
const { data, loading, error, refetch, startPolling } =
|
||||
useGetWorkspaceMemberInvitesToManageQuery({
|
||||
variables: {
|
||||
userId: user?.id,
|
||||
},
|
||||
pollInterval: 15000,
|
||||
skip: !isPlatform,
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(15000);
|
||||
}, [startPolling]);
|
||||
|
||||
if (loading) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@@ -8,9 +8,11 @@ import { useEffect } from 'react';
|
||||
|
||||
export default function SidebarWorkspaces() {
|
||||
const user = nhost.auth.getUser();
|
||||
const { data, loading, stopPolling } = useGetWorkspacesQuery({
|
||||
pollInterval: 1000,
|
||||
});
|
||||
const { data, loading, startPolling, stopPolling } = useGetWorkspacesQuery();
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(1000);
|
||||
}, [startPolling]);
|
||||
|
||||
// keep polling for workspaces until there is a workspace available.
|
||||
// We do this because when a user signs up a workspace is created automatically
|
||||
|
||||
@@ -18,12 +18,15 @@ export default function useProjectRedirectWhenReady(
|
||||
options: UseProjectRedirectWhenReadyOptions = {},
|
||||
) {
|
||||
const { currentApplication } = useCurrentWorkspaceAndApplication();
|
||||
const { data, client, ...rest } = useGetApplicationStateQuery({
|
||||
pollInterval: 2000,
|
||||
const { data, client, startPolling, ...rest } = useGetApplicationStateQuery({
|
||||
...options,
|
||||
variables: { ...options.variables, appId: currentApplication.id },
|
||||
});
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(options.pollInterval || 2000);
|
||||
}, [options.pollInterval, startPolling]);
|
||||
|
||||
useEffect(() => {
|
||||
async function updateOwnCache() {
|
||||
await client.refetchQueries({
|
||||
|
||||
@@ -21,11 +21,12 @@ export function useCheckProvisioning() {
|
||||
const [currentApplicationState, setCurrentApplicationState] =
|
||||
useState<ApplicationStateMetadata>({ state: ApplicationStatus.Empty });
|
||||
const isPlatform = useIsPlatform();
|
||||
const { data, stopPolling, client } = useGetApplicationStateQuery({
|
||||
variables: { appId: currentApplication.id },
|
||||
pollInterval: 2000,
|
||||
skip: !isPlatform,
|
||||
});
|
||||
|
||||
const { data, startPolling, stopPolling, client } =
|
||||
useGetApplicationStateQuery({
|
||||
variables: { appId: currentApplication?.id },
|
||||
skip: !isPlatform || !currentApplication?.id,
|
||||
});
|
||||
|
||||
async function updateOwnCache() {
|
||||
await client.refetchQueries({
|
||||
@@ -35,6 +36,10 @@ export function useCheckProvisioning() {
|
||||
|
||||
const memoizedUpdateCache = useCallback(updateOwnCache, [client]);
|
||||
|
||||
useEffect(() => {
|
||||
startPolling(2000);
|
||||
}, [startPolling]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!data) {
|
||||
return;
|
||||
@@ -81,7 +86,13 @@ export function useCheckProvisioning() {
|
||||
stopPolling();
|
||||
memoizedUpdateCache();
|
||||
}
|
||||
}, [data, stopPolling, memoizedUpdateCache, currentApplication.id]);
|
||||
}, [
|
||||
data,
|
||||
stopPolling,
|
||||
memoizedUpdateCache,
|
||||
currentApplication.id,
|
||||
currentApplicationState.state,
|
||||
]);
|
||||
|
||||
return currentApplicationState;
|
||||
}
|
||||
|
||||
@@ -1,22 +1,30 @@
|
||||
import { useWorkspaceContext } from '@/context/workspace-context';
|
||||
import { useGetUserAllWorkspacesQuery } from '@/generated/graphql';
|
||||
import { useWithin } from '@/hooks/useWithin';
|
||||
import { useEffect } from 'react';
|
||||
|
||||
export const useUserFirstWorkspace = () => {
|
||||
const { workspaceContext } = useWorkspaceContext();
|
||||
const { within } = useWithin();
|
||||
const fetch = !!workspaceContext.slug || !within;
|
||||
|
||||
const { loading, error, data, stopPolling, client } =
|
||||
const { loading, error, data, startPolling, stopPolling, client } =
|
||||
useGetUserAllWorkspacesQuery({
|
||||
pollInterval: 1000,
|
||||
skip: fetch,
|
||||
fetchPolicy: 'cache-first',
|
||||
});
|
||||
|
||||
if (!!workspaceContext.slug || !within) {
|
||||
useEffect(() => {
|
||||
startPolling(1000);
|
||||
}, [startPolling]);
|
||||
|
||||
useEffect(() => {
|
||||
if (!workspaceContext.slug && within) {
|
||||
return;
|
||||
}
|
||||
|
||||
stopPolling();
|
||||
}
|
||||
}, [workspaceContext.slug, within, stopPolling]);
|
||||
|
||||
return {
|
||||
loading,
|
||||
|
||||
2
pnpm-lock.yaml
generated
2
pnpm-lock.yaml
generated
@@ -77,7 +77,7 @@ importers:
|
||||
|
||||
dashboard:
|
||||
specifiers:
|
||||
'@apollo/client': ^3.6.2
|
||||
'@apollo/client': ^3.7.3
|
||||
'@babel/core': ^7.20.2
|
||||
'@codemirror/language': ^6.3.0
|
||||
'@emotion/cache': ^11.10.5
|
||||
|
||||
Reference in New Issue
Block a user