You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -21,23 +21,37 @@ Chrome/Firefox extension for easier tracking of new comments on Reddit.
21
21
22
22
## Goal
23
23
24
-
Build a custom blog script for my personal coding blog.
24
+
Get practical experience in building browser extensions. Work with low level browser API's.
25
25
26
26
## Tech stack
27
27
28
-
- Browser extension, React, RadixUI, Typescript
28
+
- Browser extension, React, Typescript, IndexedDB
29
+
- RadixUI, React Hook Form, TailwindCSS
29
30
30
31
## Features
31
32
32
-
- Static Astro website
33
+
- Highlight unread comments by visit and by time.
34
+
- State between popup UI and Reddit DOM is synced in realtime.
35
+
- Limit IndexedDB size by deleting oldest entries.
33
36
34
37
## Implementation details
35
38
36
-
You can find more implementation details in the <Linkhref="https://github.com/nemanjam/reddit-unread-comments#documentation"variant="markdown"target="_blank"title="Documentation">Documentation</Link> section on Github.
39
+
The app heavily relies on proper event handling, first of all debounced `onScroll`, but also `onLoad` and `visibilitychange` events. For all DOM manipulations it uses native `document.querySelectorAll()` without any declarative framework. Reddit uses shadow DOM which is an additional challenge for querying. I used closures to store state to save performance in loops for traversing nodes.
40
+
41
+
The popup UI is built with RadixUI components and React Hook Form. Tailwind preflight styles are disabled to prevent interfering with Reddit styles. I implemented a messaging system for communication between the popup and the content script.
42
+
43
+
All state is persisted in IndexedDB database that is limited to 1MB usage. Firefox build uses manifest v2 and Chrome manifest v3.
44
+
45
+
You can find more implementation details in the <Linkhref="https://github.com/nemanjam/reddit-unread-comments/blob/main/docs/developers-note.md"variant="markdown"target="_blank"title="Documentation">docs/developers-note.md</Link> file on Github.
37
46
38
47
## Lessons learned
39
48
40
-
- Currently Astro is the best framework for building static websites.
49
+
- People often do not have a habit to use browser extensions, it is challenging to get users.
50
+
- A solid and up-to-date extension boilerplate project might not be available and it is crucial for success.
51
+
- It can be challenging to support both v2 and v3 manifests.
52
+
- A proper retry base functionality is required for a reliable DOM traversing.
53
+
- Websites often update DOM, keeping extension up-to-date requires time and energy.
54
+
- IndexedDB has non-ergonomic API, use wrapper library instead.
0 commit comments