File tree Expand file tree Collapse file tree 1 file changed +10
-7
lines changed
packages/browser-repl/src/components Expand file tree Collapse file tree 1 file changed +10
-7
lines changed Original file line number Diff line number Diff line change @@ -162,15 +162,18 @@ export class Shell extends Component<ShellProps, ShellState> {
162
162
} ;
163
163
164
164
componentDidMount ( ) : void {
165
+ // Store the intial prop value on mount so that we're not using potentially
166
+ // updated one when actually running the lines
167
+ let evalLines : string [ ] = [ ] ;
168
+ if ( this . props . initialEvaluate ) {
169
+ evalLines = Array . isArray ( this . props . initialEvaluate )
170
+ ? this . props . initialEvaluate
171
+ : [ this . props . initialEvaluate ] ;
172
+ }
165
173
this . scrollToBottom ( ) ;
166
174
void this . updateShellPrompt ( ) . then ( async ( ) => {
167
- if ( this . props . initialEvaluate ) {
168
- const evalLines = Array . isArray ( this . props . initialEvaluate )
169
- ? this . props . initialEvaluate
170
- : [ this . props . initialEvaluate ] ;
171
- for ( const input of evalLines ) {
172
- await this . onInput ( input ) ;
173
- }
175
+ for ( const input of evalLines ) {
176
+ await this . onInput ( input ) ;
174
177
}
175
178
} ) ;
176
179
}
You can’t perform that action at this time.
0 commit comments