MCPcopy Create free account
hub / github.com/bajrangCoder/setu / rename_node

Method rename_node

src/entities/collections.rs:456–480  ·  view source on GitHub ↗
(
        &mut self,
        collection_id: Uuid,
        node_id: Uuid,
        new_name: &str,
        cx: &mut Context<Self>,
    )

Source from the content-addressed store, hash-verified

454 cx: &mut Context<Self>,
455 ) {
456 match result {
457 Ok((mut workspaces, migrated)) => {
458 self.collections = workspaces
459 .remove(&self.active_workspace_id)
460 .unwrap_or_default();
461 self.workspace_collections = workspaces;
462 self.load_state = SidebarLoadState::Ready;
463 self.bump_revision();
464 if migrated {
465 self.save_to_file();
466 }
467 }
468 Err(error) => self.load_state = SidebarLoadState::Error(error.into()),
469 }
470 cx.notify();
471 }
472
473 fn save_to_file(&self) {
474 if let Some(persistor) = &self.persistor {
475 let mut workspaces = self.workspace_collections.clone();
476 workspaces.insert(self.active_workspace_id, self.collections.clone());
477 let store = CollectionsStore {
478 version: COLLECTIONS_STORAGE_VERSION,
479 workspaces,
480 };
481 persistor.schedule_save(store);
482 }
483 }

Callers 1

Calls 2

find_node_mutFunction · 0.85
save_to_fileMethod · 0.45

Tested by

no test coverage detected