Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Import metric table from astro:db #10947

Merged
merged 3 commits into from
May 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading