feat(widgets): add server-side prefetch for weather and RSS feed
Prefetch weather and RSS feed data during SSR so widgets render with content on first paint instead of showing loading states.
This commit is contained in:
3 files changed
+55
No files matched your search
@@ -11,6 +11,8 @@ import prefetchForApps from "./app/prefetch";
|
||||
import prefetchForBookmarks from "./bookmarks/prefetch";
|
||||
import type { Prefetch, WidgetOptionsRecordOf } from "./definition";
|
||||
import type { inferOptionsFromCreator } from "./options";
|
||||
import prefetchRssFeedsAsync from "./rssFeed/prefetch";
|
||||
import prefetchWeatherAsync from "./weather/prefetch";
|
||||
|
||||
const cachedGetServerSettingsAsync = cache(getServerSettingsAsync);
|
||||
|
||||
@@ -19,6 +21,8 @@ const prefetchCallbacks: Partial<{
|
||||
}> = {
|
||||
bookmarks: prefetchForBookmarks,
|
||||
app: prefetchForApps,
|
||||
weather: prefetchWeatherAsync,
|
||||
rssFeed: prefetchRssFeedsAsync,
|
||||
};
|
||||
|
||||
export const prefetchForKindAsync = async <TKind extends WidgetKind>(
|
||||
|
||||
Reference in new issue
Block a user