Unfollow tool for Bluesky

refactor

Changed files
+4 -5
src
+4 -5
src/App.tsx
···
const [followRecords, setFollowRecords] = createStore<FollowRecord[]>([]);
const [loginState, setLoginState] = createSignal(false);
-
const [fetchState, setFetchState] = createSignal(false);
let agent: Agent;
const resolveDid = async (did: string) => {
···
await fetchFollows().then((follows) => {
setFollowCount(follows.length);
+
let tmpFollows: FollowRecord[] = [];
follows.forEach(async (record: ComAtprotoRepoListRecords.Record) => {
let status: RepoStatus | undefined = undefined;
const follow = record.value as AppBskyGraphFollow.Record;
···
: "";
if (status !== undefined) {
-
setFollowRecords(followRecords.length, {
+
tmpFollows.push({
did: follow.subject,
handle: handle,
uri: record.uri,
···
});
}
setProgress(progress() + 1);
-
if (progress() == followCount()) setFetchState(true);
+
if (progress() == followCount()) setFollowRecords(tmpFollows);
});
});
};
···
}
setFollowRecords([]);
-
setFetchState(false);
setProgress(0);
setFollowCount(0);
setNotice(
···
<Login />
<Show when={loginState()}>
<Fetch />
-
<Show when={fetchState()}>
+
<Show when={followRecords.length}>
<Follows />
</Show>
</Show>