Skip to content

Commit 858db5c

Browse files
Merge branch 'stack-auth:dev' into dev
2 parents 828813a + 10b774c commit 858db5c

File tree

108 files changed

+5444
-2674
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

108 files changed

+5444
-2674
lines changed

.vscode/settings.json

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
"cSpell.words": [
1010
"cjsx",
1111
"clsx",
12+
"cmdk",
1213
"codegen",
1314
"Crudl",
1415
"ctsx",
@@ -20,6 +21,7 @@
2021
"INBUCKET",
2122
"Jwks",
2223
"JWTs",
24+
"katex",
2325
"lucide",
2426
"Luma",
2527
"midfix",
@@ -39,18 +41,21 @@
3941
"pageleave",
4042
"pageview",
4143
"pkcco",
44+
"PKCE",
4245
"posthog",
4346
"Proxied",
4447
"psql",
4548
"qrcode",
4649
"quetzallabs",
50+
"rehype",
4751
"reqs",
4852
"RPID",
4953
"simplewebauthn",
5054
"stackframe",
5155
"supabase",
5256
"Svix",
5357
"tailwindcss",
58+
"tanstack",
5459
"totp",
5560
"tsup",
5661
"typecheck",
@@ -60,7 +65,8 @@
6065
"webapi",
6166
"webauthn",
6267
"Whitespaces",
63-
"wolfgunblood"
68+
"wolfgunblood",
69+
"zustand"
6470
],
6571
"[typescript]": {
6672
"editor.codeActionsOnSave": {

apps/backend/CHANGELOG.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,23 @@
11
# @stackframe/stack-backend
22

3+
## 2.6.21
4+
5+
### Patch Changes
6+
7+
- Fixed inviteUser
8+
- Updated dependencies
9+
- @stackframe/stack-emails@2.6.21
10+
- @stackframe/stack-shared@2.6.21
11+
12+
## 2.6.20
13+
14+
### Patch Changes
15+
16+
- Next.js 15 fixes
17+
- Updated dependencies
18+
- @stackframe/stack-emails@2.6.20
19+
- @stackframe/stack-shared@2.6.20
20+
321
## 2.6.19
422

523
### Patch Changes

apps/backend/package.json

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stackframe/stack-backend",
3-
"version": "2.6.19",
3+
"version": "2.6.21",
44
"private": true,
55
"scripts": {
66
"clean": "rimraf .next && rimraf node_modules",
@@ -60,6 +60,7 @@
6060
"pg": "^8.11.3",
6161
"posthog-node": "^4.1.0",
6262
"react": "^18.2",
63+
"react-dom": "^18.2",
6364
"semver": "^7.6.3",
6465
"server-only": "^0.0.1",
6566
"sharp": "^0.32.6",
@@ -71,7 +72,7 @@
7172
"@simplewebauthn/types": "^11.0.0",
7273
"@types/node": "^20.8.10",
7374
"@types/nodemailer": "^6.4.14",
74-
"@types/react": "^18.2.66",
75+
"@types/react": "^18.3.12",
7576
"@types/semver": "^7.5.8",
7677
"concurrently": "^8.2.2",
7778
"glob": "^10.4.1",

apps/dashboard/.env

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,5 @@ STACK_SECRET_SERVER_KEY=# enter your Stack secret client key here. For local dev
88
NEXT_PUBLIC_STACK_SVIX_SERVER_URL=# For prod, leave it empty. For local development, use `http://localhost:8113`
99

1010
# Misc, optional
11-
STACK_ACCESS_TOKEN_EXPIRATION_TIME=# enter the expiration time for the access token here. Optional, don't specify it for default value
1211
NEXT_PUBLIC_STACK_HEAD_TAGS=[{ "tagName": "script", "attributes": {}, "innerHTML": "// insert head tags here" }]
1312
STACK_DEVELOPMENT_TRANSLATION_LOCALE=# enter the locale to use for the translation provider here, for example: de-DE. Only works during development, not in production. Optional, by default don't translate

apps/dashboard/CHANGELOG.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,27 @@
11
# @stackframe/stack-dashboard
22

3+
## 2.6.21
4+
5+
### Patch Changes
6+
7+
- Fixed inviteUser
8+
- Updated dependencies
9+
- @stackframe/stack-emails@2.6.21
10+
- @stackframe/stack-shared@2.6.21
11+
- @stackframe/stack-ui@2.6.21
12+
- @stackframe/stack@2.6.21
13+
14+
## 2.6.20
15+
16+
### Patch Changes
17+
18+
- Next.js 15 fixes
19+
- Updated dependencies
20+
- @stackframe/stack-emails@2.6.20
21+
- @stackframe/stack-shared@2.6.20
22+
- @stackframe/stack-ui@2.6.20
23+
- @stackframe/stack@2.6.20
24+
325
## 2.6.19
426

527
### Patch Changes

apps/dashboard/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@stackframe/stack-dashboard",
3-
"version": "2.6.19",
3+
"version": "2.6.21",
44
"private": true,
55
"scripts": {
66
"clean": "rimraf .next && rimraf node_modules",
@@ -22,13 +22,13 @@
2222
"@next/bundle-analyzer": "^14.0.3",
2323
"@next/mdx": "^14",
2424
"@node-oauth/oauth2-server": "^5.1.0",
25-
"@radix-ui/react-icons": "^1.3.0",
25+
"@radix-ui/react-icons": "^1.3.1",
2626
"@sentry/nextjs": "^7.105.0",
2727
"@stackframe/stack": "workspace:*",
2828
"@stackframe/stack-emails": "workspace:*",
2929
"@stackframe/stack-shared": "workspace:*",
3030
"@stackframe/stack-ui": "workspace:*",
31-
"@tanstack/react-table": "^8.17.0",
31+
"@tanstack/react-table": "^8.20.5",
3232
"@vercel/analytics": "^1.2.2",
3333
"@vercel/speed-insights": "^1.0.12",
3434
"bcrypt": "^5.1.1",
@@ -46,7 +46,7 @@
4646
"posthog-js": "^1.149.1",
4747
"react": "^18.2",
4848
"react-dom": "^18",
49-
"react-hook-form": "^7.51.4",
49+
"react-hook-form": "^7.53.1",
5050
"react-icons": "^5.0.1",
5151
"rehype-katex": "^7",
5252
"remark-gfm": "^4",
@@ -63,7 +63,7 @@
6363
"@types/canvas-confetti": "^1.6.4",
6464
"@types/node": "^20.8.10",
6565
"@types/nodemailer": "^6.4.14",
66-
"@types/react": "^18.2.66",
66+
"@types/react": "^18.3.12",
6767
"@types/react-dom": "^18",
6868
"autoprefixer": "^10.4.17",
6969
"glob": "^10.4.1",

apps/dashboard/src/app/(main)/handler/[...stack]/page.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ export default function Handler(props: any) {
88
<p className="text-xs"><StyledLink href="https://www.iubenda.com/privacy-policy/19290387/cookie-policy">Terms of Service</StyledLink> and <StyledLink href="https://www.iubenda.com/privacy-policy/19290387">Privacy Policy</StyledLink></p>
99
</>;
1010
return <StackHandler
11-
fullPage {...props}
11+
fullPage
12+
routeProps={props}
1213
app={stackServerApp}
1314
componentProps={{ SignIn: { extraInfo }, SignUp: { extraInfo } }}
1415
/>;

apps/dashboard/src/components/data-table/api-key-table.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,6 @@ export function ApiKeyTable(props: { apiKeys: ApiKey[] }) {
115115
data={extendedApiKeys}
116116
columns={columns}
117117
toolbarRender={toolbarRender}
118-
defaultFilters={[{ id: 'status', value: ['valid'] }]}
118+
defaultColumnFilters={[{ id: 'status', value: ['valid'] }]}
119119
/>;
120120
}

apps/dashboard/src/components/data-table/user-table.tsx

Lines changed: 27 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
import { useAdminApp } from '@/app/(main)/(protected)/projects/[projectId]/use-admin-app';
33
import { ServerUser } from '@stackframe/stack';
44
import { deindent } from '@stackframe/stack-shared/dist/utils/strings';
5-
import { ActionCell, ActionDialog, AvatarCell, BadgeCell, CopyField, DataTableColumnHeader, DataTableManual, DateCell, SearchToolbarItem, SimpleTooltip, TextCell, Typography } from "@stackframe/stack-ui";
5+
import { ActionCell, ActionDialog, AvatarCell, BadgeCell, CopyField, DataTableColumnHeader, DataTableManualPagination, DateCell, SearchToolbarItem, SimpleTooltip, TextCell, Typography } from "@stackframe/stack-ui";
66
import { ColumnDef, ColumnFiltersState, Row, SortingState, Table } from "@tanstack/react-table";
7-
import React, { useEffect, useState } from "react";
7+
import { useState } from "react";
88
import { UserDialog } from '../user-dialog';
99

1010
export type ExtendedServerUser = ServerUser & {
@@ -184,64 +184,41 @@ export function extendUsers(users: ServerUser[]): ExtendedServerUser[] {
184184

185185
export function UserTable() {
186186
const stackAdminApp = useAdminApp();
187-
const [users, setUsers] = useState<ExtendedServerUser[]>([]);
188-
const [sorting, setSorting] = React.useState<SortingState>([{id: 'signedUpAt', desc: true}]);
189-
const [pagination, setPagination] = useState({ pageIndex: 0, pageSize: 10 });
190-
const [cursors, setCursors] = useState<Record<number, string>>({});
191-
const [columnFilters, setColumnFilters] = useState<ColumnFiltersState>([]);
192-
const [globalFilter, setGlobalFilter] = useState<any>();
193-
const [refreshCounter, setRefreshCounter] = useState(0);
194-
195-
useEffect(() => {
196-
let filters: any = {};
187+
const [filters, setFilters] = useState<Parameters<typeof stackAdminApp.listUsers>[0]>({ limit: 10, orderBy: "signedUpAt", desc: true });
188+
const users = extendUsers(stackAdminApp.useUsers(filters));
189+
190+
const onUpdate = async (options: {
191+
cursor: string,
192+
limit: number,
193+
sorting: SortingState,
194+
columnFilters: ColumnFiltersState,
195+
globalFilters: any,
196+
}) => {
197+
let filters: Parameters<typeof stackAdminApp.listUsers>[0] = {
198+
cursor: options.cursor,
199+
limit: options.limit,
200+
query: options.globalFilters,
201+
};
197202

198203
const orderMap = {
199204
signedUpAt: "signedUpAt",
200205
} as const;
201-
if (sorting.length > 0 && sorting[0].id in orderMap) {
202-
filters.orderBy = orderMap[sorting[0].id as keyof typeof orderMap];
203-
filters.desc = sorting[0].desc;
206+
if (options.sorting.length > 0 && options.sorting[0].id in orderMap) {
207+
filters.orderBy = orderMap[options.sorting[0].id as keyof typeof orderMap];
208+
filters.desc = options.sorting[0].desc;
204209
}
205210

206-
stackAdminApp.listUsers({
207-
cursor: cursors[pagination.pageIndex],
208-
limit: pagination.pageSize,
209-
query: globalFilter,
210-
...filters,
211-
}).then((users) => {
212-
setUsers(extendUsers(users));
213-
setCursors(c => users.nextCursor ? { ...c, [pagination.pageIndex + 1]: users.nextCursor } : c);
214-
}).catch(console.error);
215-
// eslint-disable-next-line react-hooks/exhaustive-deps
216-
}, [pagination, stackAdminApp, sorting, columnFilters, refreshCounter]);
217-
218-
// Reset to first page when filters change
219-
useEffect(() => {
220-
setPagination(pagination => ({ ...pagination, pageIndex: 0 }));
221-
setCursors({});
222-
}, [columnFilters, sorting, pagination.pageSize]);
223-
224-
// Refresh the users when the global filter changes. Delay to prevent unnecessary re-renders.
225-
useEffect(() => {
226-
const timer = setTimeout(() => {
227-
setRefreshCounter(x => x + 1);
228-
}, 500);
229-
return () => clearTimeout(timer);
230-
}, [globalFilter]);
211+
setFilters(filters);
212+
const users = await stackAdminApp.listUsers(filters);
213+
return { nextCursor: users.nextCursor };
214+
};
231215

232-
return <DataTableManual
216+
return <DataTableManualPagination
233217
columns={columns}
234218
data={users}
235219
toolbarRender={userToolbarRender}
236-
sorting={sorting}
237-
setSorting={setSorting}
238-
pagination={pagination}
239-
setPagination={setPagination}
240-
columnFilters={columnFilters}
241-
setColumnFilters={setColumnFilters}
220+
onUpdate={onUpdate}
242221
defaultVisibility={{ emailVerified: false }}
243-
rowCount={pagination.pageSize * Object.keys(cursors).length + (cursors[pagination.pageIndex + 1] ? 1 : 0)}
244-
globalFilter={globalFilter}
245-
setGlobalFilter={setGlobalFilter}
222+
defaultSorting={[{ id: 'signedUpAt', desc: true }]}
246223
/>;
247224
}

apps/dashboard/src/components/search-bar.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@ import React from "react";
22

33
import { Input } from "@stackframe/stack-ui";
44
import { Search } from "lucide-react";
5+
import { forwardRefIfNeeded } from "@stackframe/stack-shared/dist/utils/react";
56

6-
export const SearchBar = React.forwardRef<
7+
export const SearchBar = forwardRefIfNeeded<
78
HTMLInputElement,
89
React.InputHTMLAttributes<HTMLInputElement>
910
>((props, ref) => (

0 commit comments

Comments
 (0)