-
Notifications
You must be signed in to change notification settings - Fork 16
[Backend] Adjust active runtime initialization logic #495
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -197,10 +197,18 @@ export const createYjsSlice: StateCreator<MyState, [], [], YjsSlice> = ( | |
}); | ||
} | ||
); | ||
// Set active runtime to the first one. | ||
// Set active runtime | ||
const runtimeMap = get().getRuntimeMap(); | ||
if (runtimeMap.size > 0) { | ||
get().setActiveRuntime(Array.from(runtimeMap.keys())[0]); | ||
const runtimeList = Array.from(runtimeMap.keys()); | ||
const activeInstances = runtimeList.filter((id) => { | ||
return runtimeMap.get(id)?.status !== undefined; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The status must But I'd suggest keeping the original logic (use the first runtime regardless of its status) for now. There are many remaining logic to add:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I will continue to work on the runtime-related staff. You can focus on the selective view and don't worry too much at the runtime. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SG, I noticed that the active runtime continues reset in the UI refactor PR, and realized the root cause here. I will close this PR then. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The runtime isn't stable, but this isn't the root cause, and fixing this alone couldn't make it stable. |
||
}); | ||
if (activeInstances) { | ||
get().setActiveRuntime(activeInstances[0]); | ||
} else { | ||
get().setActiveRuntime(runtimeList[0]); | ||
} | ||
} | ||
// Set up observers to trigger future runtime status changes. | ||
runtimeMap.observe( | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good change, I meant to use
runtimeMap.delete
but forgot to uncomment it. I've actually included this in my local code.