create-fate 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/templates/fate/drizzle/client/pages/search.tsx +7 -3
- package/templates/fate/drizzle/server/src/trpc/routers/comment.ts +3 -1
- package/templates/fate/http/client/pages/search.tsx +7 -3
- package/templates/fate/http/server/src/fate/server.ts +2 -1
- package/templates/fate/prisma/client/pages/search.tsx +7 -3
- package/templates/fate/prisma/server/src/trpc/routers/comment.ts +3 -1
- package/templates/fate/void/pages/search.tsx +5 -1
- package/templates/fate/void/src/fate/server.ts +2 -1
package/package.json
CHANGED
|
@@ -23,6 +23,8 @@ const CommentSearchView = view<Comment>()({
|
|
|
23
23
|
post: CommentPostView,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
const isDevelopment = import.meta.env.DEV;
|
|
27
|
+
|
|
26
28
|
const CommentResult = ({ comment: commentRef }: { comment: ViewRef<'Comment'> }) => {
|
|
27
29
|
const comment = useView(CommentSearchView, commentRef);
|
|
28
30
|
const post = useView(CommentPostView, comment.post);
|
|
@@ -73,9 +75,11 @@ export default function SearchPage() {
|
|
|
73
75
|
ref={(ref) => ref?.focus()}
|
|
74
76
|
value={query}
|
|
75
77
|
/>
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
78
|
+
{isDevelopment ? (
|
|
79
|
+
<div className="text-xs text-muted-foreground">
|
|
80
|
+
<fbt desc="Slowdown label explanation">500ms artificial slowdown</fbt>
|
|
81
|
+
</div>
|
|
82
|
+
) : null}
|
|
79
83
|
</Stack>
|
|
80
84
|
|
|
81
85
|
<ErrorBoundary FallbackComponent={Error}>
|
|
@@ -13,6 +13,8 @@ import { fate, live, procedure, router } from '../init.ts';
|
|
|
13
13
|
import type { CommentItem } from '../views.ts';
|
|
14
14
|
import { commentDataView, postSummaryDataView } from '../views.ts';
|
|
15
15
|
|
|
16
|
+
const isDevelopment = process.env.NODE_ENV === 'development' || Boolean(process.env.DEV);
|
|
17
|
+
|
|
16
18
|
export const commentRouter = router({
|
|
17
19
|
...fate.procedures({
|
|
18
20
|
list: false,
|
|
@@ -124,7 +126,7 @@ export const commentRouter = router({
|
|
|
124
126
|
return [];
|
|
125
127
|
}
|
|
126
128
|
|
|
127
|
-
if (query.length > 1) {
|
|
129
|
+
if (isDevelopment && query.length > 1) {
|
|
128
130
|
// Artificial slowdown.
|
|
129
131
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
130
132
|
}
|
|
@@ -23,6 +23,8 @@ const CommentSearchView = view<Comment>()({
|
|
|
23
23
|
post: CommentPostView,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
const isDevelopment = import.meta.env.DEV;
|
|
27
|
+
|
|
26
28
|
const CommentResult = ({ comment: commentRef }: { comment: ViewRef<'Comment'> }) => {
|
|
27
29
|
const comment = useView(CommentSearchView, commentRef);
|
|
28
30
|
const post = useView(CommentPostView, comment.post);
|
|
@@ -73,9 +75,11 @@ export default function SearchPage() {
|
|
|
73
75
|
ref={(ref) => ref?.focus()}
|
|
74
76
|
value={query}
|
|
75
77
|
/>
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
78
|
+
{isDevelopment ? (
|
|
79
|
+
<div className="text-xs text-muted-foreground">
|
|
80
|
+
<fbt desc="Slowdown label explanation">500ms artificial slowdown</fbt>
|
|
81
|
+
</div>
|
|
82
|
+
) : null}
|
|
79
83
|
</Stack>
|
|
80
84
|
|
|
81
85
|
<ErrorBoundary FallbackComponent={Error}>
|
|
@@ -36,6 +36,7 @@ const source = createDrizzleSourceAdapter<AppContext>({
|
|
|
36
36
|
schema,
|
|
37
37
|
views: Root,
|
|
38
38
|
});
|
|
39
|
+
const isDevelopment = process.env.NODE_ENV === 'development' || Boolean(process.env.DEV);
|
|
39
40
|
|
|
40
41
|
const requireUser = (ctx: AppContext) => {
|
|
41
42
|
if (!ctx.sessionUser) {
|
|
@@ -81,7 +82,7 @@ export const fateServer = createFateServer({
|
|
|
81
82
|
};
|
|
82
83
|
}
|
|
83
84
|
|
|
84
|
-
if (query.trim().length > 1) {
|
|
85
|
+
if (isDevelopment && query.trim().length > 1) {
|
|
85
86
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
86
87
|
}
|
|
87
88
|
|
|
@@ -23,6 +23,8 @@ const CommentSearchView = view<Comment>()({
|
|
|
23
23
|
post: CommentPostView,
|
|
24
24
|
});
|
|
25
25
|
|
|
26
|
+
const isDevelopment = import.meta.env.DEV;
|
|
27
|
+
|
|
26
28
|
const CommentResult = ({ comment: commentRef }: { comment: ViewRef<'Comment'> }) => {
|
|
27
29
|
const comment = useView(CommentSearchView, commentRef);
|
|
28
30
|
const post = useView(CommentPostView, comment.post);
|
|
@@ -73,9 +75,11 @@ export default function SearchPage() {
|
|
|
73
75
|
ref={(ref) => ref?.focus()}
|
|
74
76
|
value={query}
|
|
75
77
|
/>
|
|
76
|
-
|
|
77
|
-
<
|
|
78
|
-
|
|
78
|
+
{isDevelopment ? (
|
|
79
|
+
<div className="text-xs text-muted-foreground">
|
|
80
|
+
<fbt desc="Slowdown label explanation">500ms artificial slowdown</fbt>
|
|
81
|
+
</div>
|
|
82
|
+
) : null}
|
|
79
83
|
</Stack>
|
|
80
84
|
|
|
81
85
|
<ErrorBoundary FallbackComponent={Error}>
|
|
@@ -12,6 +12,8 @@ const postSelection = {
|
|
|
12
12
|
title: true,
|
|
13
13
|
};
|
|
14
14
|
|
|
15
|
+
const isDevelopment = process.env.NODE_ENV === 'development' || Boolean(process.env.DEV);
|
|
16
|
+
|
|
15
17
|
const getCommentSelection = (select: Record<string, unknown>) => {
|
|
16
18
|
return {
|
|
17
19
|
...select,
|
|
@@ -142,7 +144,7 @@ export const commentRouter = router({
|
|
|
142
144
|
return [];
|
|
143
145
|
}
|
|
144
146
|
|
|
145
|
-
if (query.length > 1) {
|
|
147
|
+
if (isDevelopment && query.length > 1) {
|
|
146
148
|
// Artificial slowdown.
|
|
147
149
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
148
150
|
}
|
|
@@ -22,6 +22,8 @@ const CommentSearchView = view<Comment>()({
|
|
|
22
22
|
post: CommentPostView,
|
|
23
23
|
});
|
|
24
24
|
|
|
25
|
+
const isDevelopment = import.meta.env.DEV;
|
|
26
|
+
|
|
25
27
|
const CommentResult = ({ comment: commentRef }: { comment: ViewRef<'Comment'> }) => {
|
|
26
28
|
const comment = useView(CommentSearchView, commentRef);
|
|
27
29
|
const post = useView(CommentPostView, comment.post);
|
|
@@ -67,7 +69,9 @@ export default function SearchPage() {
|
|
|
67
69
|
ref={(ref) => ref?.focus()}
|
|
68
70
|
value={query}
|
|
69
71
|
/>
|
|
70
|
-
|
|
72
|
+
{isDevelopment ? (
|
|
73
|
+
<div className="text-xs text-muted-foreground">500ms artificial slowdown</div>
|
|
74
|
+
) : null}
|
|
71
75
|
</Stack>
|
|
72
76
|
|
|
73
77
|
<ErrorBoundary FallbackComponent={Error}>
|
|
@@ -39,6 +39,7 @@ const source = createDrizzleSourceAdapter<AppContext>({
|
|
|
39
39
|
schema,
|
|
40
40
|
views: Root,
|
|
41
41
|
});
|
|
42
|
+
const isDevelopment = import.meta.env.DEV;
|
|
42
43
|
export const fateLive = createVoidFateLive();
|
|
43
44
|
export const { live } = fateLive;
|
|
44
45
|
|
|
@@ -63,7 +64,7 @@ export const fateServer = createFateServer({
|
|
|
63
64
|
};
|
|
64
65
|
}
|
|
65
66
|
|
|
66
|
-
if (query.trim().length > 1) {
|
|
67
|
+
if (isDevelopment && query.trim().length > 1) {
|
|
67
68
|
await new Promise((resolve) => setTimeout(resolve, 500));
|
|
68
69
|
}
|
|
69
70
|
|