Skip to content

Commit ee4869f

Browse files
committed
chore: guard the check if the value is already true
1 parent 9f29b81 commit ee4869f

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

packages/svelte/src/compiler/phases/2-analyze/css/css-analyze.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ const css_visitors = {
7070
context.state.keyframes.push(node.prelude);
7171
} else if (node.prelude.startsWith('-global-')) {
7272
// we don't check if the block.children.length because the keyframe is still added even if empty
73-
if (is_unscoped_global(context.path)) {
73+
if (!context.state.has_unscoped_global.value && is_unscoped_global(context.path)) {
7474
context.state.has_unscoped_global.value = true;
7575
}
7676
}
@@ -98,6 +98,7 @@ const css_visitors = {
9898

9999
if (idx === 0) {
100100
if (
101+
!context.state.has_unscoped_global.value &&
101102
is_unscoped_global(context.path, context.state.rule) &&
102103
context.state.rule &&
103104
context.state.rule.block.children.length > 0
@@ -227,7 +228,11 @@ const css_visitors = {
227228
if (idx !== -1) {
228229
is_global_block = true;
229230
if (i === 0) {
230-
if (is_unscoped_global(context.path) && node.block.children.length > 0) {
231+
if (
232+
!context.state.has_unscoped_global.value &&
233+
is_unscoped_global(context.path) &&
234+
node.block.children.length > 0
235+
) {
231236
context.state.has_unscoped_global.value = true;
232237
}
233238
}

0 commit comments

Comments
 (0)