fix: address CodeRabbit review findings
- docker-table: inspect refetch result instead of .catch() (TQ v5 compat) - rssFeed: sort all entries by date before slicing to max posts - toValidDate: reject null/boolean inputs before Date construction - system-resources: reset chart history when integrationIds changes - settleIntegrationQueries: wrap fn in async boundary for safe allSettled
This commit is contained in:
5 files changed
+18
-14
No files matched your search
@@ -40,12 +40,12 @@ export const rssFeedRouter = createTRPCRouter({
|
||||
logger.warn("RSS feed fetch failed", { url: urls[index], error: result.reason });
|
||||
return [];
|
||||
})
|
||||
.slice(0, input.maximumAmountPosts)
|
||||
.toSorted((entryA, entryB) => {
|
||||
return entryA.published && entryB.published
|
||||
? new Date(entryB.published).getTime() - new Date(entryA.published).getTime()
|
||||
: 0;
|
||||
});
|
||||
})
|
||||
.slice(0, input.maximumAmountPosts);
|
||||
}),
|
||||
});
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ export async function settleIntegrationQueries<TIntegration extends IntegrationL
|
||||
integrations: TIntegration[],
|
||||
fn: (integration: TIntegration) => Promise<TResult>,
|
||||
): Promise<TResult[]> {
|
||||
const settled = await Promise.allSettled(integrations.map(fn));
|
||||
const settled = await Promise.allSettled(integrations.map(async (integration) => fn(integration)));
|
||||
return settled.flatMap((result, index) => {
|
||||
if (result.status === "fulfilled") return [result.value];
|
||||
const integration = integrations[index];
|
||||
|
||||
Reference in new issue
Block a user