David Alonso
David Alonso4mo ago

Infinite loading schema on dashboard / unable to push

Currently not able to push a schema to Convex even though type check passes and I'm not able to see the current schema in the dashboard as it shows an infinite loading state. How do I "reset" it?
No description
6 Replies
Convex Bot
Convex Bot4mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
David Alonso
David AlonsoOP4mo ago
The error is the same whether I have schemaValidation set to true or false
David Alonso
David AlonsoOP4mo ago
No description
David Alonso
David AlonsoOP4mo ago
no error in the ide whatsoever...
No description
ballingt
ballingt4mo ago
This looks lke a runtime error when you push
David Alonso
David AlonsoOP4mo ago
okay got things to work again issue was with code that looked like this:
const { fieldId, ...fieldsLayoutExcludingFieldId } =
fireviewSchema.tables.collectionViews.validator.members[0].fields.properties .fields.fieldsLayout.element.fields;
const { fieldId, ...fieldsLayoutExcludingFieldId } =
fireviewSchema.tables.collectionViews.validator.members[0].fields.properties .fields.fieldsLayout.element.fields;
seems like a runtime issue, but the code snippet above used to work before I commented out the previous table definition...
const zTableLayout = z.object({
...zCommonCollectionViewFields.shape,
layoutType: z.literal("table"),
...zStrippedFirstNDocumentsQuery.shape,
properties: zTableLayoutProperties,
});

const vTableLayout = v.object({
...zodToConvex(zTableLayout).fields,
properties: pretendWithConstraint(
zodToConvex(zTableLayoutProperties),
vAllCollectionViewLayoutProperties
),
});

const zGalleryLayout = z.object({
...zCommonCollectionViewFields.shape,
layoutType: z.literal("gallery"),
...zStrippedFirstNDocumentsQuery.shape,
properties: zGalleryLayoutProperties,
});

const vGalleryLayout = v.object({
...zodToConvex(zGalleryLayout).fields,
properties: pretendWithConstraint(
zodToConvex(zGalleryLayoutProperties),
vAllCollectionViewLayoutProperties
),
});

export const zCollectionView = z.union([
zTableLayout,
zGalleryLayout,
zChartLayout,
]);

// NOTE - Order matters!!!
// export const collectionViewsTable = defineTable(zodToConvex(zCollectionView));
export const collectionViewsTable = defineTable(
v.union(vTableLayout, vGalleryLayout, vChartLayout)
);
const zTableLayout = z.object({
...zCommonCollectionViewFields.shape,
layoutType: z.literal("table"),
...zStrippedFirstNDocumentsQuery.shape,
properties: zTableLayoutProperties,
});

const vTableLayout = v.object({
...zodToConvex(zTableLayout).fields,
properties: pretendWithConstraint(
zodToConvex(zTableLayoutProperties),
vAllCollectionViewLayoutProperties
),
});

const zGalleryLayout = z.object({
...zCommonCollectionViewFields.shape,
layoutType: z.literal("gallery"),
...zStrippedFirstNDocumentsQuery.shape,
properties: zGalleryLayoutProperties,
});

const vGalleryLayout = v.object({
...zodToConvex(zGalleryLayout).fields,
properties: pretendWithConstraint(
zodToConvex(zGalleryLayoutProperties),
vAllCollectionViewLayoutProperties
),
});

export const zCollectionView = z.union([
zTableLayout,
zGalleryLayout,
zChartLayout,
]);

// NOTE - Order matters!!!
// export const collectionViewsTable = defineTable(zodToConvex(zCollectionView));
export const collectionViewsTable = defineTable(
v.union(vTableLayout, vGalleryLayout, vChartLayout)
);
Must be something weird in the zod convex interface.. ahh it's probably got to do with the pretendWithConstraint and how that's used at runtime definitely wasn't thinking about that