Skip to content

Commit

Permalink
feat(hub): display onboarding only when user has no builds (#1947)
Browse files Browse the repository at this point in the history
<!-- Please make sure there is an issue that this PR is correlated to. -->

Closes FRONT-601

## Changes

<!-- If there are frontend changes, please include screenshots. -->
  • Loading branch information
jog1t committed Jan 28, 2025
1 parent 603c305 commit e32080d
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -505,3 +505,17 @@ export const actorManagerUrlQueryOptions = ({
},
});
};

export const actorBuildsCountQueryOptions = ({
projectNameId,
environmentNameId,
}: {
projectNameId: string;
environmentNameId: string;
}) => {
return queryOptions({
...actorBuildsQueryOptions({ projectNameId, environmentNameId }),
select: (data) => data.builds.length,
notifyOnChangeProps: ["data"],
});
};
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { GetStarted } from "@/components/get-started";
import { ActorsListPreview } from "@/domains/project/components/actors/actors-list-preview";
import * as Layout from "@/domains/project/layouts/servers-layout";
import { actorsCountQueryOptions } from "@/domains/project/queries";
import { actorBuildsCountQueryOptions } from "@/domains/project/queries";
import { Icon, faActors } from "@rivet-gg/icons";
import { useSuspenseInfiniteQuery } from "@tanstack/react-query";
import { useSuspenseQuery } from "@tanstack/react-query";
import { createFileRoute } from "@tanstack/react-router";
import { zodValidator } from "@tanstack/zod-adapter";
import { useMemo } from "react";
Expand All @@ -17,12 +17,10 @@ function ProjectActorsRoute() {
const { actorId, tags, showDestroyed } = Route.useSearch();
const tagsRecord = useMemo(() => Object.fromEntries(tags || []), [tags]);

const { data } = useSuspenseInfiniteQuery(
actorsCountQueryOptions({
const { data } = useSuspenseQuery(
actorBuildsCountQueryOptions({
projectNameId,
environmentNameId,
tags: tagsRecord,
includeDestroyed: showDestroyed ?? true,
}),
);

Expand Down

0 comments on commit e32080d

Please sign in to comment.