+9
-1
lib/hooks/usePaginatedRecords.ts
+9
-1
lib/hooks/usePaginatedRecords.ts
···
68
68
69
69
const DEFAULT_APPVIEW_SERVICE = 'https://public.api.bsky.app';
70
70
71
+
type MaybeNodeEnv = { process?: { env?: Record<string, string | undefined> } };
72
+
73
+
const isNonProductionEnv = (): boolean => {
74
+
if (typeof globalThis === 'undefined') return false;
75
+
const env = (globalThis as MaybeNodeEnv).process?.env?.NODE_ENV;
76
+
return env ? env !== 'production' : false;
77
+
};
78
+
71
79
export type AuthorFeedFilter =
72
80
| 'posts_with_replies'
73
81
| 'posts_no_replies'
···
178
186
nextCursor = feedCursor;
179
187
} catch (err) {
180
188
feedDisabledRef.current = true;
181
-
if (process.env.NODE_ENV !== 'production') {
189
+
if (isNonProductionEnv()) {
182
190
console.warn('[usePaginatedRecords] Author feed unavailable, falling back to PDS', err);
183
191
}
184
192
}