Revert "introduce decks_cache"

This was causing a crash when switching accounts

This reverts commit 69e93b0ebf.
This commit is contained in:
William Casarin
2024-12-09 09:03:34 -08:00
parent 1b31557b03
commit 32caaee642
7 changed files with 82 additions and 176 deletions

View File

@@ -1,7 +1,6 @@
use crate::{
accounts::render_accounts_route,
actionbar::NoteAction,
app::{get_active_columns, get_active_columns_mut},
notes_holder::NotesHolder,
profile::Profile,
relay_pool_manager::RelayPoolManager,
@@ -88,10 +87,7 @@ impl RenderNavResponse {
RenderNavAction::PostAction(post_action) => {
let txn = Transaction::new(&app.ndb).expect("txn");
let _ = post_action.execute(&app.ndb, &txn, &mut app.pool, &mut app.drafts);
get_active_columns_mut(&app.accounts, &mut app.decks_cache)
.column_mut(col)
.router_mut()
.go_back();
app.columns_mut().column_mut(col).router_mut().go_back();
}
RenderNavAction::NoteAction(note_action) => {
@@ -99,7 +95,7 @@ impl RenderNavResponse {
note_action.execute_and_process_result(
&app.ndb,
get_active_columns_mut(&app.accounts, &mut app.decks_cache),
&mut app.columns,
col,
&mut app.threads,
&mut app.profiles,
@@ -180,7 +176,7 @@ fn render_nav_body(
match top {
Route::Timeline(tlr) => render_timeline_route(
&app.ndb,
get_active_columns_mut(&app.accounts, &mut app.decks_cache),
&mut app.columns,
&mut app.drafts,
&mut app.img_cache,
&mut app.unknown_ids,
@@ -198,9 +194,9 @@ fn render_nav_body(
ui,
&app.ndb,
col,
&mut app.columns,
&mut app.img_cache,
&mut app.accounts,
&mut app.decks_cache,
&mut app.view_state.login,
*amr,
);
@@ -245,7 +241,7 @@ fn render_nav_body(
#[must_use = "RenderNavResponse must be handled by calling .process_render_nav_response(..)"]
pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavResponse {
let col_id = get_active_columns(&app.accounts, &app.decks_cache).get_column_id_at_index(col);
let col_id = app.columns.get_column_id_at_index(col);
// TODO(jb55): clean up this router_mut mess by using Router<R> in egui-nav directly
let nav_response = Nav::new(&app.columns().column(col).router().routes().clone())
@@ -256,7 +252,7 @@ pub fn render_nav(col: usize, app: &mut Damus, ui: &mut egui::Ui) -> RenderNavRe
NavUiType::Title => NavTitle::new(
&app.ndb,
&mut app.img_cache,
get_active_columns_mut(&app.accounts, &mut app.decks_cache),
&app.columns,
app.accounts.get_selected_account().map(|a| &a.pubkey),
nav.routes(),
)