davidhampgonsalves / Live-RSS-Bookmarks

Chrome extension that adds Firefox like RSS/Atom handling
https://davidhampgonsalves.com/13-years-of-foxish/
MIT License
46 stars 9 forks source link

Multiple bookmark folders created with same name #14

Open IB-ghs opened 5 months ago

IB-ghs commented 5 months ago

I've installed on my chrome profile and added the following feed: https://feeds.bbci.co.uk/news/rss.xml After a few hours, I get a duplicate bookmarks folder with same name (BBC News) but the bookmarks are only being updated in one folder. Then, if I open chrome on one other machine (I use at least 4 machines), then I get at least 4-5 duplicate bookmark folders and can;t tell which one is updating. If I delete some or all these folders, they get recreated. But then only one of them gets updated.

I tried using Foxish Live RSS instead. I don;t get duplicate folders but I do get duplicate entries in the same folder. This gets worse if I use on multple machines.

davidhampgonsalves commented 5 months ago

I believe I fixed this issue in the latest release. Let me know if you still run into it using Live-RSS-Bookmarks

IB-ghs commented 5 months ago

The latest version in the Play store is 5.1.1. Is this the latest? When I enable extension on first machine, I get two identical folders with the bookmarks. Then I deleted both, disabled the extension, reanabled, and had just one folder with the bookmarks. I started a second PC and opened chrome. The extension was automatically enabled because using same chrome profile as first machine. But then I ended up with four bookmark initially identical folders, replicated on both machines. I'm not sure which folder is the folder being actively updated as some of them don;t update. The problem seems to be because the chrome profile, including bookmarks, is being replicated across machines and the extension doesn;t have a way of recognising and deleting duplicate folders and ensuring only one folder gets updated across all machines using same profile. Problems: 1. why are two identical folders created when first setting up the extension with one RSS feed on one machine, no other machines/phones running same chrome profile. 2. extension doesn't seem to cope with chrome profile replication across machines/phones. Creates duplicate feed folders and not sure which is being updated. Thank you for looking at this.

IB-ghs commented 5 months ago

Actually, the replication problem is getting worse! I've left two machines running for 10 minutes and now have 6 feed folders with same name. Not sure if content same because can;t tell if the feed has been updated, but looks like they are the same content. The extensions on both machines are pointing to the same feed and using the same bookmark folder name.

pauliusg commented 3 months ago

The same for me. I get more and more folders with same name :-( Using latest version 5.1.1

@davidhampgonsalves I have looked at the code and noticed that some awaits are missing. Also, array forEach was used with async code, we should use for .. of in such cases. Those parts might cause duplicated folder issues. I have created a PR with multiple fixes also added some types with JSDoc: https://github.com/davidhampgonsalves/Live-RSS-Bookmarks/pull/17/files

I have loaded extension with my changes, so far I don't see duplicated folders.

Also, thanks for nice and useful extension!

Gausak commented 3 weeks ago

I have the same problem, duplicate folders and only the latest one is updated. I will continue using Foxish Live RSS while the problem is resolved (and Chrome allows it through the v2 manifest), otherwise, congratulations for the magnificent work!

davidhampgonsalves commented 1 week ago

@IB-ghs I believe what you are seeing is Chrome syncing your bookmarks between your browsers. I will document that bookmark syncing and this extension are incompatible since the Chrome API doesn't provide a way to exclude folders from sync (to my knowledge).

davidhampgonsalves commented 1 week ago

@Gausak Are you seeing duplicate folders b/c of the older foxish ones or two folders that the v3 manifest version created?

pauliusg commented 1 week ago

@davidhampgonsalves with my changes https://github.com/davidhampgonsalves/Live-RSS-Bookmarks/pull/17, I still got some duplicated folders but those were much less often.

Then I did some other changes:

diff --git a/src/background.js b/src/background.js
index 73b7dea..2f5b095 100644
--- a/src/background.js
+++ b/src/background.js
@@ -115,6 +115,8 @@ async function updateFeedBookmarks(feed) {
     await chrome.bookmarks.create({ title: he.decode(item.title), url: item.link, parentId: folderId });
   }

+  // Add time to the bottom of the folder for debugging purposes.^M
+  await chrome.bookmarks.create({ title: `Time ${new Date().toLocaleString()}`, url: 'https://github.com/davidhampgonsalves/Live-RSS-Bookmarks', parentId: folderId });^M
   await chrome.bookmarks.create({ title: `Open ${feed.name}`, url: feed.url, parentId: folderId });
 }

@@ -129,11 +131,16 @@ chrome.runtime.onInstalled.addListener(async ({ reason }) => {
   await chrome.alarms.clear("poll");
   await chrome.alarms.create("poll", { periodInMinutes: 20 }); // does this run in 20 or now AND in 20?
   chrome.alarms.onAlarm.addListener(async () => {
-    const config = await loadConfig();
-    await updateFeeds(config)
+    await init();^M
   });
 });

+// That was probably the issue as not commented out code below also runs on startup.^M
+// chrome.runtime.onStartup.addListener(async () => {^M
+//   await init();^M
+// });^M
+^M
+// This code also runs on startup:^M
 (async () => {
   await init();
 })();

As you can see, init function was called twice at the same browser startup time. Now it is completely stable, no duplicated folders anymore.

I can make additional PR without debugging item inside RSS folders and with onStartup listener code removal if you want.

davidhampgonsalves commented 1 week ago

Thanks @pauliusg, that makes sense re: init running multiple times. Thanks for sharing.

I would be happy if you wanted to open a PR but I can also make the change you outlined if that's easier.

Gausak commented 1 week ago

@Gausak Are you seeing duplicate folders b/c of the older foxish ones or two folders that the v3 manifest version created?

Folders repeat with Live RSS Bookmarks version 5.1.1, that's why I stopped using it momentarily until it is solved and in the meantime I continue using Foxish Live RSS

pauliusg commented 1 week ago

@davidhampgonsalves, sorry looks like I misinformed you. Too much time has been passed from my tests. The commented code part:

+// chrome.runtime.onStartup.addListener(async () => {^M
+//   await init();^M
+// });^M

was added by me probably when I wanted to test something. That wasn't in your code. Other change should not make any difference as it does the same, just code is not duplicated:

@@ -129,11 +131,16 @@ chrome.runtime.onInstalled.addListener(async ({ reason }) => {
   await chrome.alarms.clear("poll");
   await chrome.alarms.create("poll", { periodInMinutes: 20 }); // does this run in 20 or now AND in 20?
   chrome.alarms.onAlarm.addListener(async () => {
-    const config = await loadConfig();
-    await updateFeeds(config)
+    await init();^M
   })u
 });

The only difference, which runs in my browser now, is this part:

@@ -115,6 +115,8 @@ async function updateFeedBookmarks(feed) {
     await chrome.bookmarks.create({ title: he.decode(item.title), url: item.link, parentId: folderId });
   }

+  // Add time to the bottom of the folder for debugging purposes.^M
+  await chrome.bookmarks.create({ title: `Time ${new Date().toLocaleString()}`, url: 'https://github.com/davidhampgonsalves/Live-RSS-Bookmarks', parentId: folderId });^M
   await chrome.bookmarks.create({ title: `Open ${feed.name}`, url: feed.url, parentId: folderId });
 }

but I would not believe that it fixes something :-)

So, now I don't understand why I don't see duplicates anymore on my browser for a long time :-) There is a little chance that there was some bug in Chrome and now I have new Chrome version with a fix.

I will try to run pure newest master code on my browser to see if duplicates will be back and will inform you after several days.

Gausak commented 1 week ago

@davidhampgonsalves, sorry looks like I misinformed you. Too much time has been passed from my tests. The commented code part:

+// chrome.runtime.onStartup.addListener(async () => {^M
+//   await init();^M
+// });^M

was added by me probably when I wanted to test something. That wasn't in your code. Other change should not make any difference as it does the same, just code is not duplicated:

@@ -129,11 +131,16 @@ chrome.runtime.onInstalled.addListener(async ({ reason }) => {
   await chrome.alarms.clear("poll");
   await chrome.alarms.create("poll", { periodInMinutes: 20 }); // does this run in 20 or now AND in 20?
   chrome.alarms.onAlarm.addListener(async () => {
-    const config = await loadConfig();
-    await updateFeeds(config)
+    await init();^M
   })u
 });

The only difference, which runs in my browser now, is this part:

@@ -115,6 +115,8 @@ async function updateFeedBookmarks(feed) {
     await chrome.bookmarks.create({ title: he.decode(item.title), url: item.link, parentId: folderId });
   }

+  // Add time to the bottom of the folder for debugging purposes.^M
+  await chrome.bookmarks.create({ title: `Time ${new Date().toLocaleString()}`, url: 'https://github.com/davidhampgonsalves/Live-RSS-Bookmarks', parentId: folderId });^M
   await chrome.bookmarks.create({ title: `Open ${feed.name}`, url: feed.url, parentId: folderId });
 }

but I would not believe that it fixes something :-)

So, now I don't understand why I don't see duplicates anymore on my browser for a long time :-) There is a little chance that there was some bug in Chrome and now I have new Chrome version with a fix.

I will try to run pure newest master code on my browser to see if duplicates will be back and will inform you after several days.

Will we have a new working version? THANK YOU SO MUCH! This extension is a must have for me.

davidhampgonsalves commented 1 week ago

Yes @Gausak I'll build a new version and put it out after I hear back from @pauliusg

pauliusg commented 1 week ago

@davidhampgonsalves, I haven't noticed any duplicates with newest master code so far. I used browser as usual for couple days, also restarted it several times.

davidhampgonsalves commented 1 week ago

Thanks @pauliusg , I'll push out a new version soon then.

pauliusg commented 2 days ago

@davidhampgonsalves, when do plan to release new version?

By the way, no new duplicates after a week of usage :-)

davidhampgonsalves commented 1 day ago

Should be this week. Glad to hear.

On Wed, Sep 4, 2024 at 12:17 PM Paulius Grabauskas @.***> wrote:

@davidhampgonsalves https://github.com/davidhampgonsalves, when do plan to release new version?

By the way, no new duplicates after a week of usage :-)

— Reply to this email directly, view it on GitHub https://github.com/davidhampgonsalves/Live-RSS-Bookmarks/issues/14#issuecomment-2329351663, or unsubscribe https://github.com/notifications/unsubscribe-auth/AABLVTJOE4Q7LG6HMUYLNFLZU4QBVAVCNFSM6AAAAABE7WTVLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGMRZGM2TCNRWGM . You are receiving this because you were mentioned.Message ID: @.***>