Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
This repository was archived by the owner on Aug 5, 2025. It is now read-only.

Commit 9145fea

Browse files
committed
fix(plugin-react): avoid duplicate add html data
1 parent 9485c29 commit 9145fea

File tree

3 files changed

+3
-5
lines changed

3 files changed

+3
-5
lines changed

‎packages/plugin-react/src/html/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { isArray } from 'util';
21
import { PluginAPI } from '@alicloud/console-toolkit-core';
32

43
type HtmlDataKey = 'head' | 'metas' | 'styles' | 'headscripts' | 'prescripts' | 'scripts';
@@ -27,7 +26,7 @@ export default function(api: PluginAPI) {
2726

2827
const addToData = (name: HtmlDataKey) => (data: string) => {
2928
const field = htmlData[name];
30-
if (isArray(field)) {
29+
if (Array.isArray(field)&&!field.includes(data)) {
3130
field.push(data);
3231
} else {
3332
// @ts-ignore

‎packages/plugin-webpack5-react/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@alicloud/console-toolkit-plugin-webpack5-react",
3-
"version": "1.2.2",
3+
"version": "1.2.3",
44
"description": "console toolkit plugin for base react app",
55
"main": "lib/index.js",
66
"scripts": {

‎packages/plugin-webpack5-react/src/html/index.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
import { isArray } from 'util';
21
import { PluginAPI } from '@alicloud/console-toolkit-core';
32

43
type HtmlDataKey = 'head' | 'metas' | 'styles' | 'headscripts' | 'prescripts' | 'scripts';
@@ -27,7 +26,7 @@ export default function(api: PluginAPI) {
2726

2827
const addToData = (name: HtmlDataKey) => (data: string) => {
2928
const field = htmlData[name];
30-
if (isArray(field)) {
29+
if (Array.isArray(field)&&!field.includes(data)) {
3130
field.push(data);
3231
} else {
3332
// @ts-ignore

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /