Browse Source

Fix transition hiccup in programs + prevent WS from being closed on pause

main
Stian Fredrik Aune 2 years ago
parent
commit
33becbae4a
  1. 2
      webui-react/src/contexts/RuntimeContext.tsx
  2. 4
      webui-react/src/pages/runtime/ProgramBoi.tsx
  3. 2
      ykonsole-ktor/src/main/kotlin/net/aiterp/git/ykonsole2/application/plugins/Install.kt

2
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 => {

4
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);
}
}
}
}

2
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)
}
}
Loading…
Cancel
Save