mirror of https://github.com/alibaba/ice.git
fix: duplicate css (#7137)
CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Details
CI / build (16.x, windows-latest) (push) Has been cancelled
Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled
Details
CI / build (18.x, windows-latest) (push) Has been cancelled
Details
Coverage / coverage (16.x) (push) Has been cancelled
Details
Release / Release (16) (push) Has been cancelled
Details
CI / build (16.x, ubuntu-latest) (push) Has been cancelled
Details
CI / build (16.x, windows-latest) (push) Has been cancelled
Details
CI / build (18.x, ubuntu-latest) (push) Has been cancelled
Details
CI / build (18.x, windows-latest) (push) Has been cancelled
Details
Coverage / coverage (16.x) (push) Has been cancelled
Details
Release / Release (16) (push) Has been cancelled
Details
* fix: duplicate css * chore: add changelog * fix: lint
This commit is contained in:
parent
fcc25dc3fd
commit
2742ac4678
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
'@ice/runtime': patch
|
||||
---
|
||||
|
||||
fix: duplicate css
|
|
@ -1,7 +1,7 @@
|
|||
import * as React from 'react';
|
||||
import type { WindowContext, RouteMatch, AssetsManifest } from './types.js';
|
||||
import { useAppContext, useAppData } from './AppContext.js';
|
||||
import { getMeta, getTitle, getLinks, getScripts } from './routesConfig.js';
|
||||
import { getLinks, getMeta, getScripts, getTitle } from './routesConfig.js';
|
||||
import type { AssetsManifest, RouteMatch, WindowContext } from './types.js';
|
||||
import getCurrentRoutePath from './utils/getCurrentRoutePath.js';
|
||||
|
||||
interface DocumentContext {
|
||||
|
@ -81,7 +81,15 @@ export const Links: LinksType = (props: LinksProps) => {
|
|||
const routeLinks = getLinks(matches, loaderData);
|
||||
const pageAssets = getPageAssets(matches, assetsManifest);
|
||||
const entryAssets = getEntryAssets(assetsManifest);
|
||||
const styles = entryAssets.concat(pageAssets).filter(path => path.indexOf('.css') > -1);
|
||||
let styles = entryAssets.concat(pageAssets).filter(path => path.indexOf('.css') > -1);
|
||||
|
||||
// Unique styles for duplicate CSS files.
|
||||
const cssSet = {};
|
||||
styles = styles.filter((style) => {
|
||||
if (cssSet[style]) return false;
|
||||
cssSet[style] = true;
|
||||
return true;
|
||||
});
|
||||
|
||||
return (
|
||||
<>
|
||||
|
|
Loading…
Reference in New Issue