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

Fix: Left over references and make some more space in the cookie table. #584

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions packages/common/src/constants/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,3 @@
* limitations under the License.
*/
export const UNKNOWN_FRAME_KEY = 'Unknown Frames';
export const ORPHANED_COOKIE_KEY = 'Orphaned Cookies';
export const UNMAPPED_COOKIE_KEY = 'Unmapped Cookies';
9 changes: 2 additions & 7 deletions packages/extension/src/utils/getFramesForCurrentTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,7 @@
/**
* External dependencies
*/
import {
type TabFrames,
ORPHANED_COOKIE_KEY,
UNMAPPED_COOKIE_KEY,
} from '@ps-analysis-tool/common';
import { type TabFrames } from '@ps-analysis-tool/common';

/**
* Internal dependencies
Expand Down Expand Up @@ -66,7 +62,6 @@ export default async function getFramesForCurrentTab() {
return tabFrame;
})
);
modifiedTabFrames[ORPHANED_COOKIE_KEY] = { frameIds: [] };
modifiedTabFrames[UNMAPPED_COOKIE_KEY] = { frameIds: [] };

return modifiedTabFrames;
}
6 changes: 0 additions & 6 deletions packages/extension/src/utils/tests/getFramesForCurrentTab.ts
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,6 @@ describe('getFramesForCurrentTab : ', () => {
isOnRWS: false,
frameType: 'sub_frame',
},
'Orphaned Cookies': {
frameIds: [],
},
'Unmapped Cookies': {
frameIds: [],
},
});
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -22,38 +22,20 @@ import {
CookiesMatrix,
prepareFrameStatsComponent,
} from '@ps-analysis-tool/design-system';
import {
ORPHANED_COOKIE_KEY,
UNMAPPED_COOKIE_KEY,
} from '@ps-analysis-tool/common';
/**
* Internal dependencies
*/
import { useCookie } from '../../../stateProviders';

const FramesSection = () => {
const { tabCookies, tabFrames, frameHasCookies } = useCookie(({ state }) => ({
const { tabCookies, tabFrames } = useCookie(({ state }) => ({
tabCookies: state.tabCookies,
tabFrames: state.tabFrames,
frameHasCookies: state.frameHasCookies,
}));

const processedTabFrames = useMemo(
() =>
Object.fromEntries(
Object.entries(tabFrames || {}).filter(([url]) => {
if (url === ORPHANED_COOKIE_KEY) {
return frameHasCookies[url];
}

if (url === UNMAPPED_COOKIE_KEY) {
return frameHasCookies[url];
}

return true;
})
),
[tabFrames, frameHasCookies]
() => Object.fromEntries(Object.entries(tabFrames || {})),
[tabFrames]
);

const framesStats = prepareFrameStatsComponent(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,12 +164,14 @@ const useCookieListing = (domainsInAllowList: Set<string>) => {
{
header: 'Priority',
accessorKey: 'parsedCookie.priority',
isHiddenByDefault: true,
cell: (info: InfoType) => info,
widthWeightagePercentage: 4,
},
{
header: 'Size',
accessorKey: 'parsedCookie.size',
isHiddenByDefault: true,
cell: (info: InfoType) => info,
widthWeightagePercentage: 3,
},
Expand Down
Loading