@@ -12,7 +12,13 @@ import { redefine } from "@suid/system/createStyled";
12
12
import { InPropsOf } from "@suid/types" ;
13
13
import randomString from "@suid/utils/randomString" ;
14
14
import clsx from "clsx" ;
15
- import { createEffect , createSignal , JSX , Show } from "solid-js" ;
15
+ import {
16
+ createEffect ,
17
+ createRenderEffect ,
18
+ createSignal ,
19
+ JSX ,
20
+ Show ,
21
+ } from "solid-js" ;
16
22
17
23
const $ = createComponentFactory < LinearProgressTypeMap > ( ) ( {
18
24
name : "MuiLinearProgress" ,
@@ -302,11 +308,6 @@ const LinearProgress = $.component(function LinearProgress({
302
308
element . ref . ariaValueNow = Math . round ( props . value ) . toString ( ) ;
303
309
element . ref . ariaValueMin = "0" ;
304
310
element . ref . ariaValueMax = "100" ;
305
- let transform = props . value - 100 ;
306
- if ( theme . direction === "rtl" ) {
307
- transform = - transform ;
308
- }
309
- setBar1Style ( { transform : `translateX(${ transform } %)` } ) ;
310
311
} else if ( process . env . NODE_ENV !== "production" ) {
311
312
console . error (
312
313
"MUI: You need to provide a value prop " +
@@ -316,6 +317,18 @@ const LinearProgress = $.component(function LinearProgress({
316
317
}
317
318
} ) ;
318
319
320
+ createRenderEffect ( ( ) => {
321
+ if ( props . variant === "determinate" || props . variant === "buffer" ) {
322
+ if ( props . value !== undefined ) {
323
+ let transform = props . value - 100 ;
324
+ if ( theme . direction === "rtl" ) {
325
+ transform = - transform ;
326
+ }
327
+ setBar1Style ( { transform : `translateX(${ transform } %)` } ) ;
328
+ }
329
+ }
330
+ } ) ;
331
+
319
332
createEffect ( ( ) => {
320
333
if ( props . variant === "buffer" ) {
321
334
if ( props . valueBuffer !== undefined ) {
0 commit comments