Skip to content

Commit

Permalink
normalize cache key
Browse files Browse the repository at this point in the history
  • Loading branch information
salazarm committed Sep 27, 2023
1 parent 9ad323a commit d220cf7
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ const AssetGraphExplorerWithData: React.FC<WithDataProps> = ({
assetGraphData,
// Use the pathname as part of the key so that different deployments don't invalidate each other's cached layout
// Remove the slash at the end in the key so that the same layout is used for both `/path` and `/path/`
`explorer:${pathname.endsWith('/') ? pathname.slice(0, pathname.length - 1) : pathname}`,
`explorer:${normalizePathnameForCacheKey(pathname)}`,
fullAssetGraphData,
);
const viewportEl = React.useRef<SVGViewport>();
Expand Down Expand Up @@ -585,3 +585,9 @@ const assetKeyTokensInRange = (

return uniq(ledToTarget);
};

function normalizePathnameForCacheKey(pathname: string) {
const _path = pathname.endsWith('/') ? pathname.slice(0, pathname.length - 1) : pathname;
// Remove the op query string
return _path.split('~')[0];
}

0 comments on commit d220cf7

Please sign in to comment.