@@ -195,7 +195,7 @@ const isLocationBookmarked = (state, location) => {
195
195
const bookmarks = bookmarksState . getBookmarks ( state )
196
196
const siteKeys = bookmarkLocationCache . getCacheKey ( state , location )
197
197
198
- if ( siteKeys . isEmpty ( ) ) {
198
+ if ( siteKeys . isEmpty ( ) || bookmarks . isEmpty ( ) ) {
199
199
return false
200
200
}
201
201
@@ -218,20 +218,6 @@ const toCreateProperties = (bookmark) => {
218
218
}
219
219
}
220
220
221
- /**
222
- * Filters bookmarks relative to a parent folder
223
- * @param state - The application state
224
- * @param folderKey The folder key to filter to
225
- */
226
- const getBookmarksByParentId = ( state , folderKey ) => {
227
- const bookmarks = bookmarksState . getBookmarks ( state )
228
- if ( ! folderKey ) {
229
- return bookmarks
230
- }
231
-
232
- return bookmarks . filter ( ( bookmark ) => bookmark . get ( 'parentFolderId' ) === folderKey )
233
- }
234
-
235
221
const isBookmark = ( bookmark ) => {
236
222
if ( bookmark == null ) {
237
223
return false
@@ -241,9 +227,10 @@ const isBookmark = (bookmark) => {
241
227
}
242
228
243
229
const updateTabBookmarked = ( state , tabValue ) => {
244
- if ( ! tabValue || ! tabValue . get ( 'tabId' ) ) {
230
+ if ( ! tabValue || ! tabValue . has ( 'tabId' ) ) {
245
231
return state
246
232
}
233
+
247
234
const bookmarked = isLocationBookmarked ( state , tabValue . get ( 'url' ) )
248
235
return tabState . updateTabValue ( state , tabValue . set ( 'bookmarked' , bookmarked ) )
249
236
}
@@ -253,7 +240,8 @@ const updateActiveTabBookmarked = (state) => {
253
240
if ( ! tab ) {
254
241
return state
255
242
}
256
- return updateTabBookmarked ( state , tab )
243
+
244
+ return module . exports . updateTabBookmarked ( state , tab )
257
245
}
258
246
259
247
const getKey = ( siteDetail ) => {
@@ -282,7 +270,6 @@ module.exports = {
282
270
getDetailFromFrame,
283
271
isLocationBookmarked,
284
272
toCreateProperties,
285
- getBookmarksByParentId,
286
273
isBookmark,
287
274
updateTabBookmarked,
288
275
updateActiveTabBookmarked,
0 commit comments