fix: concurrent cache miss, SVG output, narrowed error handling, format

- Fix integration data cache: check pending promise before TTL to
  prevent returning undefined on concurrent cold-cache access
- Add concurrent-miss test (two parallel callers, one fetch)
- SVG sanitizer: extract <svg> from DOMPurify output to strip
  residual HTML wrapper
- Narrow safeRevalidateTag catch: log unexpected errors, silence only
  known "outside request scope" messages
- Run oxfmt across all packages (206 files formatted)
This commit is contained in:
Thomas Camlong committed 2026-08-07 20:48:17 +02:00
1 parent b81b90875f
commit 38ac8f3075
206 files changed
+7952 -6722

No files matched your search

+14 -14
View File
@@ -42,21 +42,21 @@ export const umamiRouter = createTRPCRouter({
return await settleIntegrationQueries(
ctx.integrations,
async (integration) => {
const innerHandler = umamiRequestHandler.handler(integration, {
websiteId: input.websiteId,
timeFrame: input.timeFrame,
eventName: input.eventName,
});
const { data, timestamp } = await innerHandler.getDataAsync();
const innerHandler = umamiRequestHandler.handler(integration, {
websiteId: input.websiteId,
timeFrame: input.timeFrame,
eventName: input.eventName,
});
const { data, timestamp } = await innerHandler.getDataAsync();
return {
integrationId: integration.id,
integrationName: integration.name,
integrationUrl: integration.url,
visitorStats: data,
updatedAt: timestamp,
};
},
return {
integrationId: integration.id,
integrationName: integration.name,
integrationUrl: integration.url,
visitorStats: data,
updatedAt: timestamp,
};
},
{
queryKey: integrationQueryKey("umami", "getVisitorStats", {
websiteId: input.websiteId,