Skip to content

Commit

Permalink
Fix "save all tabs" when there more than 1000 open tabs
Browse files Browse the repository at this point in the history
  • Loading branch information
Rustem Mussabekov committed Jun 17, 2024
1 parent 7765e0a commit b230202
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 19 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "app",
"version": "5.6.36",
"version": "5.6.37",
"description": "All-in-one bookmark manager",
"author": "Rustem Mussabekov",
"license": "MIT",
Expand Down
30 changes: 19 additions & 11 deletions src/data/sagas/bookmarks/single.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { call, put, takeEvery, select } from 'redux-saga/effects'
import Api from '../../modules/api'
import _ from 'lodash-es'

import {
BOOKMARK_LOAD_REQ, BOOKMARK_LOAD_SUCCESS, BOOKMARK_LOAD_ERROR,
Expand Down Expand Up @@ -111,21 +112,28 @@ function* createBookmarks({items=[], ignore=false, onSuccess, onFail}) {
if (ignore) return;

try{
const res = yield call(Api.post, 'raindrops', {
items: items.map(item=>({
...item,
pleaseParse: {
weight: items.length
}
}))
}, { timeout: 0 })
let created = []

const chunks = _.chunk(items, 999)
for(const chunk of chunks){
const res = yield call(Api.post, 'raindrops', {
items: chunk.map(item=>({
...item,
pleaseParse: {
weight: items.length
}
}))
}, { timeout: 0 })

created.push(...res.items)
}

yield put({
type: BOOKMARK_CREATE_SUCCESS,
_id: res.items.map(({_id})=>_id),
item: res.items,
_id: created.map(({_id})=>_id),
item: created,
onSuccess, onFail
});
})
} catch (error) {
yield put({
type: BOOKMARK_CREATE_ERROR,
Expand Down
14 changes: 7 additions & 7 deletions src/target/extension/background/highlights/highlight.js

Large diffs are not rendered by default.

0 comments on commit b230202

Please sign in to comment.