Skip to content

Commit 1bd9b68

Browse files
committed
fix updating mid-list
1 parent 78fcfe7 commit 1bd9b68

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

special-pages/pages/new-tab/app/activity/ActivityProvider.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,8 @@ export function SignalStateProvider({ children }) {
295295
urls.value = normalizeUrls(urls.value, evt.data);
296296
const visible = keys.value;
297297
const all = urls.value;
298-
const nextVisibleRange = all.slice(0, Math.max(service.INITIAL, Math.min(service.INITIAL, visible.length)));
298+
const nextVisibleRange = all.slice(0, Math.max(service.INITIAL, Math.max(service.INITIAL, visible.length)));
299+
console.log({ nextVisibleRange });
299300
setVisibleRange(nextVisibleRange);
300301
fillHoles();
301302
});

special-pages/pages/new-tab/app/activity/batched-activity.service.js

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -220,18 +220,19 @@ export class BatchedActivityService {
220220
* @param {string} url
221221
*/
222222
remove(url) {
223-
this.dataService.update((old) => {
223+
this.urlService.update((old) => {
224+
const next = old.urls.filter((x) => x !== url);
224225
return {
225226
...old,
226-
activity: old.activity.filter((item) => {
227-
return item.url !== url;
228-
}),
227+
urls: next,
229228
};
230229
});
231-
this.urlService.update((old) => {
230+
this.dataService.update((old) => {
232231
return {
233232
...old,
234-
urls: old.urls.filter((x) => x !== url),
233+
activity: old.activity.filter((item) => {
234+
return item.url !== url;
235+
}),
235236
};
236237
});
237238
this.ntp.messaging.notify('activity_removeItem', { url });

0 commit comments

Comments
 (0)