FujoWebDev / FujoWebDev/fujocoded-plugins

Add `afterAll` hook to ATProto loader for post-pipeline collection transforms

Open
#37 0 comments 0 reactions 0 assignees View on GitHub
astro-atproto-loader
Dominant language
TypeScript
Stars
30
Forks
7
PR merge metrics
No merged PRs in 30d

Description

The ATProto loader pipeline currently runs `parseRecord → filter → groupBy → transform` per record (or group of records). This means any operation that needs to see the *whole* collection (e.g. sorting it) has to be written again every time the collection is used, which offends me personally.

Instead, we should add an optional `afterAll` hook to both `defineAtProtoLiveCollection` and `defineAtProtoCollection`.

This would run after all transforms have completed, get an array with all the entries, and return the final shape of the data. Obviously, callers can then do any type of re-ordering of re-filtering they’d like, but at least one could have e.g. a guarantee that their posts are always returned in chronological order.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.