easoncxz / twitanalysis

Dig your Twitter data
https://easoncxz.github.io/twitanalysis
Other
1 stars 0 forks source link

Build some basic list-management functionality #24

Closed easoncxz closed 3 years ago

easoncxz commented 3 years ago

image

The idea is to quickly add accounts to other lists.

Reference material

easoncxz commented 3 years ago

image

Looking good. List of Lists is arriving in the UI.

The next step is to dig more information out about each List:

easoncxz commented 3 years ago

API summary:

Implementation tasks:

Related reading:

Question:

easoncxz commented 3 years ago

Some progress:

image

easoncxz commented 3 years ago

Looking very good -- I got some kind of manual-JOIN working in idb. As such, I was able to load from idb:

image

I got confused a lot by the question of what should be the keyPath for the index. This is the crucial diff:

diff --git a/frontend-app/src/dom/twitter/storage.ts b/frontend-app/src/dom/twitter/storage.ts
index e262fb2..cd2ce8c 100644
--- a/frontend-app/src/dom/twitter/storage.ts
+++ b/frontend-app/src/dom/twitter/storage.ts
@@ -67,7 +67,7 @@ export async function openMyDB(): Promise<IDBPDatabase<TwitDb>> {
             autoIncrement: true,
           });
           // TODO: what to use as index keyPath?
-          listMemberships.createIndex('by-list', [], {
+          listMemberships.createIndex('by-list', 'listIdStr', {
             unique: false,
           });
         }

Over the course of debugging it, I came across another crucial question and answer -- how to do composite keys in IndexedDB object-stores? See this StackOverflow post:

Update: In fact, I later came across more errors, and found a StackOverflow that points out precisely my problem -- [] is not valid as a keyPath:

easoncxz commented 3 years ago

Added new journal about IndexedDB index concerns:

easoncxz commented 3 years ago

For showing the tweets of a given user in the middle-pane in this UI, we're finally facing the problem of dealing with timelines. See Twitter docs:

easoncxz commented 3 years ago

I have an incredibly ugly UI that demonstrates the ability to "focus" on a user:

image

The thing toggles, and stuff works.

easoncxz commented 3 years ago

Pretty steady progress here:

image

easoncxz commented 3 years ago

As of commits 40cd7af and 6aa146c, there is a rather useful amount of functionality now: any member-user of any list can now be added to or removed from any list.

It's starting to be useful enough that screenshots would show more than I prefer them to! Closing this issue now.