-
Notifications
You must be signed in to change notification settings - Fork 902
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
fix: segments modals #2070
fix: segments modals #2070
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 2 Ignored Deployments
|
Thank you for following the naming conventions for pull request titles! 🙏 |
apps/web/app/(app)/environments/[environmentId]/(peopleAndSegments)/segments/components/BasicSegmentSettings.tsxConsider using a more descriptive variable name than } catch (error: any) {
toast.error("Something went wrong. Please try again.");
}
Consider using const handleAddFilterInGroup = useCallback((filter: TBaseFilter) => {
const updatedSegment = structuredClone(segment);
if (updatedSegment?.filters?.length === 0) {
updatedSegment.filters.push({
...filter,
connector: null,
});
} else {
updatedSegment?.filters.push(filter);
}
setSegment(updatedSegment);
}, [segment]);
Consider using const handleUpdateSegment = useCallback(async () => {
if (!segment.title) {
toast.error("Title is required.");
return;
}
try {
setIsUpdatingSegment(true);
await updateBasicSegmentAction(segment.environmentId, segment.id, {
title: segment.title,
description: segment.description ?? "",
isPrivate: segment.isPrivate,
filters: segment.filters,
});
setIsUpdatingSegment(false);
toast.success("Segment updated successfully!");
} catch (error: any) {
const parsedFilters = ZSegmentFilters.safeParse(segment.filters);
if (!parsedFilters.success) {
toast.error("Invalid filters. Please check the filters and try again.");
} else {
toast.error("Something went wrong. Please try again.");
}
setIsUpdatingSegment(false);
return;
}
setIsUpdatingSegment(false);
handleResetState();
router.refresh();
}, [segment, router]);
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@pandeymangg 💪 thank you for the modal fixes 😊💪🚀
What does this PR do?
Fixes the modals on the segments page showing encrypted error messages on production. The segment edit and create modals now have the save button disabled if a segment has no title or if the filters are wrong.
Fixes # (issue)
How should this be tested?
Checklist
Required
pnpm build
console.logs
git pull origin main
Appreciated