Skip to content

Commit

Permalink
fix(browser-repl): make sure we are actually using initial value of i…
Browse files Browse the repository at this point in the history
…nitialEvaluate (#2058)
  • Loading branch information
gribnoysup authored Jul 5, 2024
1 parent 06085a7 commit 50fbbdb
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/browser-repl/src/components/shell.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,18 @@ export class Shell extends Component<ShellProps, ShellState> {
};

componentDidMount(): void {
// Store the intial prop value on mount so that we're not using potentially
// updated one when actually running the lines
let evalLines: string[] = [];
if (this.props.initialEvaluate) {
evalLines = Array.isArray(this.props.initialEvaluate)
? this.props.initialEvaluate
: [this.props.initialEvaluate];
}
this.scrollToBottom();
void this.updateShellPrompt().then(async () => {
if (this.props.initialEvaluate) {
const evalLines = Array.isArray(this.props.initialEvaluate)
? this.props.initialEvaluate
: [this.props.initialEvaluate];
for (const input of evalLines) {
await this.onInput(input);
}
for (const input of evalLines) {
await this.onInput(input);
}
});
}
Expand Down

0 comments on commit 50fbbdb

Please sign in to comment.