Skip to content

Commit

Permalink
Import metric table from astro:db (#10947)
Browse files Browse the repository at this point in the history
  • Loading branch information
delucis authored May 6, 2024
1 parent 23fb790 commit e63e96b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
5 changes: 5 additions & 0 deletions .changeset/tough-numbers-build.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@astrojs/web-vitals": patch
---

Fixes a runtime issue where Vite was unintentionally pulled into the server code
4 changes: 2 additions & 2 deletions packages/integrations/web-vitals/src/db-config.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { column, defineDb, defineTable } from 'astro:db';
import { asDrizzleTable } from '@astrojs/db/utils';
// import { asDrizzleTable } from '@astrojs/db/utils';

const Metric = defineTable({
columns: {
Expand All @@ -13,7 +13,7 @@ const Metric = defineTable({
},
});

export const AstrojsWebVitals_Metric = asDrizzleTable('AstrojsWebVitals_Metric', Metric);
// export const AstrojsWebVitals_Metric = asDrizzleTable('AstrojsWebVitals_Metric', Metric);

export default defineDb({
tables: {
Expand Down
4 changes: 2 additions & 2 deletions packages/integrations/web-vitals/src/endpoint.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { db, sql } from 'astro:db';
// @ts-expect-error — AstrojsWebVitals requires type-gen which we can’t use.
import { db, sql, AstrojsWebVitals_Metric } from 'astro:db';
import type { APIRoute } from 'astro';
import { AstrojsWebVitals_Metric } from './db-config.js';
import { ServerMetricSchema } from './schemas.js';

export const prerender = false;
Expand Down

0 comments on commit e63e96b

Please sign in to comment.