ここで最善のパターン/アプローチについて疑問に思っていました。これは私のルーターの関数なので、ユーザーは「quotes/:id」を押しますが、そのビューをレンダリングするには、プロジェクト、顧客、および通貨のリストが必要です。quotesEdit
ビューをインスタンス化する前に、3 つの fetches() がすべて発生したことを確認する最善の方法は何でしょうか? ユーザーが何かをクリックしたときにすべての情報を取得することは悪い習慣と見なされますか?
quotesEdit: function(id) {
kf.Collections.quotes = kf.Collections.quotes || new kf.Collections.Quotes();
kf.Collections.projects = kf.Collections.projects || new kf.Collections.Projects();
kf.Collections.currencies = kf.Collections.currencies || new kf.Collections.Currencies();
//do a fetch() for the 3 above
kf.Collections.customers = kf.Collections.customers || new kf.Collections.Customers();
var quote = kf.Collections.quotes.where({Id: parseInt(id, 10)});
kf.Utils.ViewManager.swap('sectionPrimary', new kf.Views.section({
section: 'quotesEdit',
model: quote[0]
}));
}