Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: tidy up #1011

Merged
merged 1 commit into from
Oct 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion apps/renderer/src/store/feed/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ export const useFeedStore = createZustandStore<FeedState>("feed")(() => ({

const set = useFeedStore.setState
const get = useFeedStore.getState
const distanceTime = 1000 * 60 * 60 * 9
class FeedActions {
clear() {
set({ feeds: {} })
Expand All @@ -40,7 +41,7 @@ class FeedActions {
if (
feed.type === "feed" &&
feed.errorAt &&
new Date(feed.errorAt).getTime() > Date.now() - 1000 * 60 * 60 * 9
new Date(feed.errorAt).getTime() > Date.now() - distanceTime
) {
feed.errorAt = null
}
Expand Down
10 changes: 3 additions & 7 deletions apps/renderer/src/store/image/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,9 @@ class ImageActions {
}

async fetchDimensionsFromDb(images: string[]) {
const dims = [] as StoreImageType[]
for (const image of images) {
const dbData = await getImageDimensionsFromDb(image)
if (dbData) {
dims.push(dbData)
}
}
const dims = (await Promise.all(images.map((image) => getImageDimensionsFromDb(image)))).filter(
Boolean,
) as StoreImageType[]
imageActions.saveImages(dims)
}

Expand Down
Loading