Don't allow saving segments on share page.
This commit is contained in:
@@ -25,13 +25,14 @@ export function FilterBar({ websiteId }: { websiteId: string }) {
|
|||||||
const { formatValue } = useFormat();
|
const { formatValue } = useFormat();
|
||||||
const {
|
const {
|
||||||
router,
|
router,
|
||||||
|
pathname,
|
||||||
updateParams,
|
updateParams,
|
||||||
replaceParams,
|
replaceParams,
|
||||||
query: { segment, cohort },
|
query: { segment, cohort },
|
||||||
} = useNavigation();
|
} = useNavigation();
|
||||||
const { filters, operatorLabels } = useFilters();
|
const { filters, operatorLabels } = useFilters();
|
||||||
const { data, isLoading } = useWebsiteSegmentQuery(websiteId, segment || cohort);
|
const { data, isLoading } = useWebsiteSegmentQuery(websiteId, segment || cohort);
|
||||||
const canSaveSegment = filters.length > 0 && !segment && !cohort;
|
const canSaveSegment = filters.length > 0 && !segment && !cohort && !pathname.includes('/share');
|
||||||
|
|
||||||
const handleCloseFilter = (param: string) => {
|
const handleCloseFilter = (param: string) => {
|
||||||
router.push(updateParams({ [param]: undefined }));
|
router.push(updateParams({ [param]: undefined }));
|
||||||
|
|||||||
Reference in New Issue
Block a user