Skip to content

Conversation

@rohilsurana
Copy link
Member

@rohilsurana rohilsurana commented Nov 12, 2025

Summary

Migrated admin UI components from REST API (Axios) to ConnectRPC queries and mutations for improved type safety and consistency.

Changes

  • Migrated organizations list, projects, members, and audit logs to use useQuery, useMutation, and useInfiniteQuery hooks
  • Replaced imperative clients.frontier() and clients.admin() calls with declarative ConnectRPC hooks
  • Updated types from V1Beta1* to modern types from @raystack/proton/frontier
  • Migrated field naming from snake_case to camelCase (e.g., role_idsroleIds, postal_codepostalCode)
  • Added error handling with toast notifications for failed operations
  • Enabled binary mode for admin client exports (audit logs, organizations)
  • Removed unused REST API client files (~/api/frontier.ts, ~/api/index.ts)

Technical Details

  • Used create() with RequestSchema types for type-safe request construction
  • Applied useInfiniteQuery for paginated data with RQL support
  • Disabled sorting on endpoints that don't support it (e.g., searchProjectUsers)
  • Used createClient() pattern for imperative calls when hooks aren't suitable (e.g., policy management)

Test Plan

  • Manual testing of migrated components
  • Build and type checking passes

@vercel
Copy link

vercel bot commented Nov 12, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
frontier Error Error Nov 14, 2025 1:14pm

@coveralls
Copy link

coveralls commented Nov 12, 2025

Pull Request Test Coverage Report for Build 19365674208

Details

  • 0 of 0 changed or added relevant lines in 0 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 37.614%

Totals Coverage Status
Change from base Build 19354415206: 0.0%
Covered Lines: 15634
Relevant Lines: 41564

💛 - Coveralls

import { RQLExportRequest } from "@raystack/proton/frontier";

const adminClient = clients.admin({ useBinary: false });
const adminClient = clients.admin({ useBinary: true });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why have we changed this?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for smaller network transfers. binary format uses less data.

onRemove,
onClose,
}: RemoveMemberProps) => {
const [isSubmitting, setIsSubmitting] = useState(false);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can remove the submitting useState and use the isPending var from useMutation.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

good point, let me do that.

: "Unknown error";
toast.error(`Failed to remove member: ${message}`);
console.error(error);
} finally {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Finallly block will also be removed if using isPending.

FrontierServiceQueries,
GetProjectRequestSchema,
ListRolesRequestSchema,
} from "@raystack/proton/frontier";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@raystack/proton/frontier these two imports can be merged.

console.error(error);
} finally {
setIsProjectRolesLoading(false);
const { data: projectRoles = [], isLoading: isProjectRolesLoading } = useQuery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Error handling required.

SearchOrganizationProjectsResponse_OrganizationProject,
} from "@raystack/proton/frontier";

import { FrontierServiceQueries, UpdateProjectRequestSchema } from "@raystack/proton/frontier";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raystack/proton/frontier imports can be merged

@@ -1,21 +1,23 @@
import { DataTable, EmptyState, Flex } from "@raystack/apsara";
import type { DataTableQuery, DataTableSort } from "@raystack/apsara";
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

raystack/apsara Imports can be merged here

},
);

const { data: plans = [], isLoading: isPlansLoading } = useQuery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

error handling

console.error(error);
} finally {
setIsLoading(false);
const { data: defaultRoles = [], isLoading: isDefaultRolesLoading } = useQuery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

}, []);
);

const { data: organizationRoles = [], isLoading: isOrgRolesLoading } = useQuery(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants