Artwork

المحتوى المقدم من Kent C. Dodds. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة Kent C. Dodds أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.
Player FM - تطبيق بودكاست
انتقل إلى وضع عدم الاتصال باستخدام تطبيق Player FM !

How far can nested UI loaders go for UIs with list of components

7:37
 
مشاركة
 

Manage episode 505989096 series 2982717
المحتوى المقدم من Kent C. Dodds. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة Kent C. Dodds أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.

the UI at https://nothing.tech/products/phone-3 renders a list of "widgets". I would like each of these widgets to have their own loaders to maximise page speed, furthermore I'd be able to "deeplink" a user straight into a widget. But how do I do that when a route can only have one Outlet?

Here's an example with Promise.all. Before:

// routes/dashboard.tsx export async function loader() { const user = await fetch('/api/user').then(r => r.json()) const projects = await fetch(`/api/projects?userId=${user.id}`).then(r => r.json()) const notifications = await fetch(`/api/notifications?userId=${user.id}`).then(r => r.json()) return { user, projects, notifications } }

After:

export async function loader() { const userPromise = fetch('/api/user').then(r => r.json()) const projectsPromise = userPromise.then(user => fetch(`/api/projects?userId=${user.id}`).then(r => r.json()) ) const notificationsPromise = userPromise.then(user => fetch(`/api/notifications?userId=${user.id}`).then(r => r.json()) ) const [user, projects, notifications] = await Promise.all([ userPromise, projectsPromise, notificationsPromise, ]) return { user, projects, notifications } }

Kent's notes:

I forgot that defer is now unnecessary, simply return an object from your loader and any properties on that object that are promises will be sent along as deferred data automatically. Learn more from the links below.

How far can nested UI loaders go for UIs with list of components
  continue reading

217 حلقات

Artwork
iconمشاركة
 
Manage episode 505989096 series 2982717
المحتوى المقدم من Kent C. Dodds. يتم تحميل جميع محتويات البودكاست بما في ذلك الحلقات والرسومات وأوصاف البودكاست وتقديمها مباشرة بواسطة Kent C. Dodds أو شريك منصة البودكاست الخاص بهم. إذا كنت تعتقد أن شخصًا ما يستخدم عملك المحمي بحقوق الطبع والنشر دون إذنك، فيمكنك اتباع العملية الموضحة هنا https://ar.player.fm/legal.

the UI at https://nothing.tech/products/phone-3 renders a list of "widgets". I would like each of these widgets to have their own loaders to maximise page speed, furthermore I'd be able to "deeplink" a user straight into a widget. But how do I do that when a route can only have one Outlet?

Here's an example with Promise.all. Before:

// routes/dashboard.tsx export async function loader() { const user = await fetch('/api/user').then(r => r.json()) const projects = await fetch(`/api/projects?userId=${user.id}`).then(r => r.json()) const notifications = await fetch(`/api/notifications?userId=${user.id}`).then(r => r.json()) return { user, projects, notifications } }

After:

export async function loader() { const userPromise = fetch('/api/user').then(r => r.json()) const projectsPromise = userPromise.then(user => fetch(`/api/projects?userId=${user.id}`).then(r => r.json()) ) const notificationsPromise = userPromise.then(user => fetch(`/api/notifications?userId=${user.id}`).then(r => r.json()) ) const [user, projects, notifications] = await Promise.all([ userPromise, projectsPromise, notificationsPromise, ]) return { user, projects, notifications } }

Kent's notes:

I forgot that defer is now unnecessary, simply return an object from your loader and any properties on that object that are promises will be sent along as deferred data automatically. Learn more from the links below.

How far can nested UI loaders go for UIs with list of components
  continue reading

217 حلقات

كل الحلقات

×
 
Loading …

مرحبًا بك في مشغل أف ام!

يقوم برنامج مشغل أف أم بمسح الويب للحصول على بودكاست عالية الجودة لتستمتع بها الآن. إنه أفضل تطبيق بودكاست ويعمل على أجهزة اندرويد والأيفون والويب. قم بالتسجيل لمزامنة الاشتراكات عبر الأجهزة.

 

دليل مرجعي سريع

حقوق الطبع والنشر 2025 | سياسة الخصوصية | شروط الخدمة | | حقوق النشر
استمع إلى هذا العرض أثناء الاستكشاف
تشغيل