nova-tabs
nova-tabs copied to clipboard
rendering the contents of a tab only if it's active
Currently all relations of a resource are loaded on the Detail view, regardless of whether they're in the active tab or not. This leads to many unnecessary requests being made on the initial pageload. This PR addresses that issue.
Nice!
Really nice, but probably it would be better to have an option to handle this situation. Sometimes it can be useful to have all relations loaded at the same time.
Fair point, I've also added an option to the Tab
class to allow conditional preloading.
Example usage:
Tabs::make('Some Title', [
Tab::make('Balance', [
Number::make('Balance', 'balance'),
Number::make('Total', 'total'),
]),
// This relation will load on initial pageload
Tab::make('Invoices', [
HasMany::make('Invoices'),
])
->preload(),
// This relation will load only when the tab is activated
Tab::make('Notes', [
HasMany::make('Notes'),
]),
Tab::make('Other Info', [
Number::make('Paid To Date', 'paid_to_date')
]),
]),
Any chance to get this merged?
Hey @marcfilipan could you maybe take a look at it?
Hey @marcfilipan , mind merging this?
Has anyone managed to get this working locally? I see @karan-darji and @vladcazacu have been making commits towards fixing it, but pulling it in locally seems to make zero difference to the tabs. I have one specific resource that loads over 100 requests (some with queries ranging from 1-8 queries each), and limiting tabs would be incredible.