lemonmade / quilt

MIT License
35 stars 8 forks source link

Polish async module APIs #697

Open lemonmade opened 4 months ago

lemonmade commented 4 months ago

Some more ideas:

import {asyncModule} from '@quilted/async';
import {PreloadModule, asyncComponent} from '@quilted/react-async';

const myModule = asyncModule(() => import('./my-module'));
const myModuleUpdatedWithBundler = asyncModule(() => import('./my-module'), {
  id: 'my-module.abc123.js',
  cache: globalThis[Symbol.for('quilt')].moduleCache,
});

const componentModule = asyncModule(() => import('./MyComponent'));
const MyComponent = asyncComponent(componentModule);

const resolved = await myModule();
const resolved2 = await myModule.resolved;
const resolved3 = myModule.resolved.value;
const resolved3Error = myModule.resolved.error;

<PreloadModule module={myModule} />;
<MyComponent />;
lemonmade commented 1 month ago

https://qwik.dev/docs/route-loader/

https://start.solidjs.com/core-concepts/data-loading

lemonmade commented 1 month ago

https://tanstack.com/query/latest/docs/framework/react/reference/useQuery https://tanstack.com/query/latest/docs/reference/QueryClient https://tanstack.com/query/latest/docs/framework/react/guides/filters#query-filters https://tanstack.com/query/latest/docs/framework/svelte/reactivity https://tanstack.com/query/latest/docs/framework/react/guides/mutations

lemonmade commented 1 month ago

https://developer.mozilla.org/en-US/docs/Web/API/Cache/put https://developers.cloudflare.com/kv/api/list-keys/ https://redux-toolkit.js.org/rtk-query/overview

lemonmade commented 1 month ago

https://www.apollographql.com/docs/react/api/cache/InMemoryCache

lemonmade commented 1 month ago

https://reactrouter.com/en/main/hooks/use-loader-data https://reactrouter.com/en/main/route/loader

lemonmade commented 1 month ago

https://swr.vercel.app/docs/data-fetching https://swr.vercel.app/docs/middleware

lemonmade commented 1 week ago

https://tanstack.com/router/latest/docs/framework/react/guide/data-loading