diff --git a/webui-react/src/contexts/RuntimeContext.tsx b/webui-react/src/contexts/RuntimeContext.tsx index 2d0dceb..f74c1df 100644 --- a/webui-react/src/contexts/RuntimeContext.tsx +++ b/webui-react/src/contexts/RuntimeContext.tsx @@ -186,7 +186,7 @@ export function RuntimeContextProvider({children}: WithChildren): JSX.Element { }; setSocket(socket); - }, [socket]); + }, []); const create = useCallback((options: CreateWorkoutOptions) => { workoutRepo().createWorkout(options).then(success => { diff --git a/webui-react/src/pages/runtime/ProgramBoi.tsx b/webui-react/src/pages/runtime/ProgramBoi.tsx index 0b37b46..ff21c3c 100644 --- a/webui-react/src/pages/runtime/ProgramBoi.tsx +++ b/webui-react/src/pages/runtime/ProgramBoi.tsx @@ -95,6 +95,10 @@ function programReducer(state: ProgressState, change: ProgressChange) { steps[currentIndex].actualDuration = diffLinearValues(lastValue, lastTransition); currentIndex += 1; lastTransition = lastValue; + + if (steps.length > currentIndex) { + calculateToNext(steps[currentIndex], lastValue, lastTransition); + } } } } diff --git a/ykonsole-ktor/src/main/kotlin/net/aiterp/git/ykonsole2/application/plugins/Install.kt b/ykonsole-ktor/src/main/kotlin/net/aiterp/git/ykonsole2/application/plugins/Install.kt index 893be8e..189e4fd 100644 --- a/ykonsole-ktor/src/main/kotlin/net/aiterp/git/ykonsole2/application/plugins/Install.kt +++ b/ykonsole-ktor/src/main/kotlin/net/aiterp/git/ykonsole2/application/plugins/Install.kt @@ -15,6 +15,7 @@ import io.ktor.server.websocket.* import net.aiterp.git.ykonsole2.application.logging.log import net.aiterp.git.ykonsole2.infrastructure.ktor.YKonsoleResponseException import net.aiterp.git.ykonsole2.infrastructure.ktor.ykStatusResponse +import java.time.Duration internal object YKonsoleErrorHandler @@ -51,5 +52,6 @@ fun Application.installPlugins() { install(WebSockets) { contentConverter = JacksonWebsocketContentConverter(ykObjectMapper) + pingPeriod = Duration.ofSeconds(15) } }