mirror of
https://github.com/plausible/analytics.git
synced 2024-11-28 21:47:25 +03:00
Fix routes not opening that take dynamic route params when the param contains forward slash (#4824)
This commit is contained in:
parent
b0933e1730
commit
d187e59049
@ -12,6 +12,7 @@ All notable changes to this project will be documented in this file.
|
|||||||
|
|
||||||
- Fix returning filter suggestions for multiple custom property values in the dashboard Filter modal
|
- Fix returning filter suggestions for multiple custom property values in the dashboard Filter modal
|
||||||
- Fix typo on login screen
|
- Fix typo on login screen
|
||||||
|
- Fix Direct / None details modal not opening
|
||||||
|
|
||||||
## v2.1.4 - 2024-10-08
|
## v2.1.4 - 2024-10-08
|
||||||
|
|
||||||
|
@ -72,7 +72,7 @@ function SpecialPropBreakdown({ prop, afterFetchData }) {
|
|||||||
getFilterFor={getFilterFor}
|
getFilterFor={getFilterFor}
|
||||||
keyLabel={prop}
|
keyLabel={prop}
|
||||||
metrics={chooseMetrics()}
|
metrics={chooseMetrics()}
|
||||||
detailsLinkProps={{ path: customPropsRoute.path, params: {propKey: prop}, search: (search) => search }}
|
detailsLinkProps={{ path: customPropsRoute.path, params: {propKey: url.maybeEncodeRouteParam(prop)}, search: (search) => search }}
|
||||||
externalLinkDest={externalLinkDest()}
|
externalLinkDest={externalLinkDest()}
|
||||||
maybeHideDetails={true}
|
maybeHideDetails={true}
|
||||||
color="bg-red-50"
|
color="bg-red-50"
|
||||||
|
@ -23,7 +23,7 @@ function PropsModal() {
|
|||||||
const reportInfo = {
|
const reportInfo = {
|
||||||
title: specialTitleWhenGoalFilter(query, 'Custom Property Breakdown'),
|
title: specialTitleWhenGoalFilter(query, 'Custom Property Breakdown'),
|
||||||
dimension: propKey,
|
dimension: propKey,
|
||||||
endpoint: url.apiPath(site, `/custom-prop-values/${propKey}`),
|
endpoint: url.apiPath(site, `/custom-prop-values/${url.maybeEncodeRouteParam(propKey)}`),
|
||||||
dimensionLabel: propKey,
|
dimensionLabel: propKey,
|
||||||
defaultOrder: ["visitors", SortDirection.desc]
|
defaultOrder: ["visitors", SortDirection.desc]
|
||||||
}
|
}
|
||||||
|
@ -19,7 +19,8 @@ function ReferrerDrilldownModal() {
|
|||||||
const reportInfo = {
|
const reportInfo = {
|
||||||
title: "Referrer Drilldown",
|
title: "Referrer Drilldown",
|
||||||
dimension: 'referrer',
|
dimension: 'referrer',
|
||||||
endpoint: url.apiPath(site, `/referrers/${referrer}`),
|
endpoint: url.apiPath(site, `/referrers/${url.maybeEncodeRouteParam(referrer)}`
|
||||||
|
),
|
||||||
dimensionLabel: "Referrer",
|
dimensionLabel: "Referrer",
|
||||||
defaultOrder: ["visitors", SortDirection.desc]
|
defaultOrder: ["visitors", SortDirection.desc]
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,8 @@ import { useQueryContext } from '../../query-context';
|
|||||||
import { useSiteContext } from '../../site-context';
|
import { useSiteContext } from '../../site-context';
|
||||||
import { referrersDrilldownRoute } from '../../router';
|
import { referrersDrilldownRoute } from '../../router';
|
||||||
|
|
||||||
|
const NO_REFERRER = 'Direct / None'
|
||||||
|
|
||||||
export default function Referrers({ source }) {
|
export default function Referrers({ source }) {
|
||||||
const { query } = useQueryContext();
|
const { query } = useQueryContext();
|
||||||
const site = useSiteContext()
|
const site = useSiteContext()
|
||||||
@ -27,12 +29,12 @@ export default function Referrers({ source }) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function externalLinkDest(referrer) {
|
function externalLinkDest(referrer) {
|
||||||
if (referrer.name === 'Direct / None') { return null }
|
if (referrer.name === NO_REFERRER) { return null }
|
||||||
return `https://${referrer.name}`
|
return `https://${referrer.name}`
|
||||||
}
|
}
|
||||||
|
|
||||||
function getFilterFor(referrer) {
|
function getFilterFor(referrer) {
|
||||||
if (referrer.name === 'Direct / None') { return null }
|
if (referrer.name === NO_REFERRER) { return null }
|
||||||
|
|
||||||
return {
|
return {
|
||||||
prefix: 'referrer',
|
prefix: 'referrer',
|
||||||
@ -70,7 +72,7 @@ export default function Referrers({ source }) {
|
|||||||
getFilterFor={getFilterFor}
|
getFilterFor={getFilterFor}
|
||||||
keyLabel="Referrer"
|
keyLabel="Referrer"
|
||||||
metrics={chooseMetrics()}
|
metrics={chooseMetrics()}
|
||||||
detailsLinkProps={{ path: referrersDrilldownRoute.path, params: {referrer: source}, search: (search) => search }}
|
detailsLinkProps={{ path: referrersDrilldownRoute.path, params: {referrer: url.maybeEncodeRouteParam(source)}, search: (search) => search }}
|
||||||
externalLinkDest={externalLinkDest}
|
externalLinkDest={externalLinkDest}
|
||||||
renderIcon={renderIcon}
|
renderIcon={renderIcon}
|
||||||
color="bg-blue-50"
|
color="bg-blue-50"
|
||||||
|
@ -151,3 +151,7 @@ export function parseSearch(searchString: string): Record<string, unknown> {
|
|||||||
urlSearchParams.forEach((v, k) => (searchRecord[k] = parseSearchFragment(v)))
|
urlSearchParams.forEach((v, k) => (searchRecord[k] = parseSearchFragment(v)))
|
||||||
return searchRecord
|
return searchRecord
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function maybeEncodeRouteParam(param: string) {
|
||||||
|
return param.includes('/') ? encodeURIComponent(param) : param
|
||||||
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user