Pass a handle to the current view model when spawning
Most of the time, we'll want a way to get a reference back to the current view or model, so this facilitates that common case.
This commit is contained in:
@@ -477,9 +477,8 @@ impl Buffer {
|
||||
let snapshot = self.snapshot();
|
||||
let version = self.version.clone();
|
||||
let file = self.file.clone();
|
||||
let handle = ctx.handle();
|
||||
|
||||
ctx.spawn(|mut ctx| async move {
|
||||
ctx.spawn(|handle, mut ctx| async move {
|
||||
if let Some(file) = new_file.as_ref().or(file.as_ref()) {
|
||||
let result = ctx.read(|ctx| file.save(snapshot, ctx.as_ref())).await;
|
||||
if result.is_ok() {
|
||||
|
||||
Reference in New Issue
Block a user