Skip to content

Commit

Permalink
Attach session for run all button
Browse files Browse the repository at this point in the history
  • Loading branch information
frederic-reis committed Jul 26, 2024
1 parent 103c05b commit 1d75da3
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/components/ArticleV3/ArticleThebeSession.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import React from 'react'
import React, { useEffect } from 'react'
import { useArticleThebe } from './ArticleThebeProvider'
import ArticleThebeSessionButton, {
StatusReady,
Expand All @@ -8,8 +8,9 @@ import ArticleThebeSessionButton, {
import { useExecutionScope } from './ExecutionScope'

const ArticleThebeSession = ({ debug = false, kernelName }) => {
const { starting, ready, connectAndStart, shutdown, restart } = useArticleThebe()
const { starting, ready, connectAndStart, shutdown, restart, session } = useArticleThebe()
const executeAll = useExecutionScope((state) => state.executeAll)
const attachSession = useExecutionScope((state) => state.attachSession);
let status = StatusIdle

if (ready) {
Expand All @@ -18,6 +19,11 @@ const ArticleThebeSession = ({ debug = false, kernelName }) => {
status = StatusPreparing
}

useEffect(() => {
if (ready)
attachSession(session);
}, [ready]);

const handleSession = () => {
if (status === StatusIdle) {
connectAndStart()
Expand Down

0 comments on commit 1d75da3

Please sign in to comment.