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

Adds table missing alert to destination cards on Job page #3184

Merged
merged 15 commits into from
Jan 23, 2025

Conversation

alishakawaguchi
Copy link
Contributor

Screenshot 2025-01-23 at 10 24 21 AM

2025-01-23 10 23 58

@alishakawaguchi alishakawaguchi added the enhancement New feature or request label Jan 23, 2025
@alishakawaguchi alishakawaguchi self-assigned this Jan 23, 2025
Copy link

vercel bot commented Jan 23, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Skipped Deployment
Name Status Preview Comments Updated (UTC)
neosync-docs ⬜️ Ignored (Inspect) Visit Preview Jan 23, 2025 8:05pm

Base automatically changed from alisha/neos-1725-error-codes to main January 23, 2025 18:33
Copy link
Member

@nickzelei nickzelei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is awesome, left a comment regarding maybe moving the validation from usemutation to usequery for simpler code

@@ -159,10 +221,43 @@ export default function DestinationConnectionCard({
<FormDescription>
The location of the destination data set.
</FormDescription>
<FormMessage />
{/* <FormMessage /> */}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔

Comment on lines 96 to 125
async function validateMappings(connectionId: string) {
if (!jobmappings || jobmappings.length == 0) {
return;
}
try {
const body = create(ValidateJobMappingsRequestSchema, {
accountId: account?.id,
mappings: jobmappings,
virtualForeignKeys: [],
connectionId: connectionId,
});
const res = await validateJobMappingsAsync(body);
setValidateMappingsResponse(res);
} catch (error) {
console.error('Failed to validate job mappings:', error);
toast.error('Unable to validate job mappings', {
description: getErrorMessage(error),
});
}
}

useEffect(() => {
if (!account?.id || !destination.connectionId || jobmappingsLength === 0) {
return;
}
const validateJobMappings = async () => {
await validateMappings(destination.connectionId);
};
validateJobMappings();
}, [account?.id, destination.connectionId, jobmappingsLength]);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm, why isn't this just a useQuery? All queries can be conditionally enabled anyways, which is basically your if condition.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another thought is that we could also conditionally invoke only if the init table schema is not enabled? maybe that is unnecessary though.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

copy paste 😭

Comment on lines 231 to 232
tableErrors &&
tableErrors.length > 0 && (
Copy link
Member

@nickzelei nickzelei Jan 23, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably worth adding a loading state/skeleton here from the query for larger databases where the validation may take a while.

Copy link
Member

@nickzelei nickzelei left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sick

@@ -195,7 +172,7 @@ export default function DestinationConnectionCard({
shouldValidate: true,
}
);
validateMappings(value);
// validateMappings(value);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove

@alishakawaguchi alishakawaguchi merged commit af76484 into main Jan 23, 2025
7 checks passed
@alishakawaguchi alishakawaguchi deleted the alisha/destination-errors branch January 23, 2025 20:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants