mirror of
https://gitlab.com/walljm/dynamicbible.git
synced 2025-07-23 15:30:14 -04:00
oops, no data in the current cards anymore. and, since you store the id in the qry, you don't need to remove get it from the card cache.
This commit is contained in:
parent
e3c87cf660
commit
fae6bac6cd
@ -308,6 +308,7 @@ export function reducer(state: AppState, action: AppAction): AppState {
|
|||||||
cardCache: removeFromCardCache(action.card, state.cardCache),
|
cardCache: removeFromCardCache(action.card, state.cardCache),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
case 'MOVE_CARD': {
|
case 'MOVE_CARD': {
|
||||||
const cards = moveItemUpOrDown(state.currentCards, action.card, action.direction);
|
const cards = moveItemUpOrDown(state.currentCards, action.card, action.direction);
|
||||||
|
|
||||||
@ -438,14 +439,15 @@ export function reducer(state: AppState, action: AppAction): AppState {
|
|||||||
// so iterate through all of them and if you find the note
|
// so iterate through all of them and if you find the note
|
||||||
// in any of them, remove it
|
// in any of them, remove it
|
||||||
|
|
||||||
const card = state.currentCards.find((o) => o.qry === `note: ${action.note.id}`);
|
const card = state.currentCards.find((o) => o.qry === action.note.id);
|
||||||
|
|
||||||
const cards = [
|
const cards = card
|
||||||
...state.currentCards.filter((o) => {
|
? [
|
||||||
const n = getFromCardCache(o, state.cardCache);
|
...state.currentCards.filter((o) => {
|
||||||
return o.type !== CardType.Note || (n.data as NoteItem).id !== action.note.id;
|
return o.type !== CardType.Note || o.qry !== action.note.id;
|
||||||
}),
|
}),
|
||||||
];
|
]
|
||||||
|
: state.currentCards; // if card is undefined, then it wasn't in the current card list.
|
||||||
|
|
||||||
const notes = new Storable<NoteItem[]>([...state.notes.value.filter((o) => o.id !== action.note.id)]);
|
const notes = new Storable<NoteItem[]>([...state.notes.value.filter((o) => o.id !== action.note.id)]);
|
||||||
|
|
||||||
@ -454,8 +456,7 @@ export function reducer(state: AppState, action: AppAction): AppState {
|
|||||||
return {
|
return {
|
||||||
...sp,
|
...sp,
|
||||||
queries: sp.queries.filter((o) => {
|
queries: sp.queries.filter((o) => {
|
||||||
const n = getFromCardCache(o, state.cardCache);
|
return o.type !== CardType.Note || o.qry !== action.note.id;
|
||||||
return o.type !== CardType.Note || (n.data as NoteItem).id !== action.note.id;
|
|
||||||
}),
|
}),
|
||||||
};
|
};
|
||||||
}),
|
}),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user