Skip to content

Commit 9d1cb1b

Browse files
committed
wip
1 parent 43b68e7 commit 9d1cb1b

3 files changed

Lines changed: 4 additions & 106 deletions

File tree

src/Livewire/BaseContentTreeNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,8 @@ protected function transformRecordIntoNode($record)
133133
'__content_document_type_cat' => $record?->documentType?->category,
134134
'__content_tree_id' => $record?->nestableTree?->getKey(),
135135

136+
'__content_is_default' => $record->is_default === true,
137+
136138
'url' => $url,
137139
'__fi_resource_page' => $resourcePage,
138140

src/Livewire/ContentSidebar.php

Lines changed: 0 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -120,112 +120,6 @@ protected function getNodeItemActions(): array
120120
];
121121
}
122122

123-
// public function getNodeItemActionsByNodes(array $nodes): array
124-
// {
125-
// if (!$this->showNodeActions) {
126-
// return [];
127-
// }
128-
129-
// // Step 1: Generate cache key from node IDs
130-
// $cacheKey = $this->generateNodesCacheKey($nodes);
131-
132-
// // Step 2: Check if actions are already cached
133-
// if (isset($this->nodeActionsCache[$cacheKey])) {
134-
// return $this->nodeActionsCache[$cacheKey];
135-
// }
136-
137-
// // Step 3: Get base actions template
138-
// $baseActions = $this->getNodeItemActions();
139-
// if (empty($baseActions)) {
140-
// return [];
141-
// }
142-
143-
// // Step 4: Fetch records and apply to actions
144-
// $formattedActions = $this->formatActionsWithRecords($baseActions, $nodes);
145-
146-
// // Step 5: Cache the formatted actions
147-
// $this->nodeActionsCache[$cacheKey] = $formattedActions;
148-
149-
// return $formattedActions;
150-
// }
151-
152-
// protected function generateNodesCacheKey(array $nodes): string
153-
// {
154-
// $nodeIds = array_column($nodes, 'id');
155-
// sort($nodeIds); // Ensure consistent ordering
156-
// return md5(implode('|', $nodeIds));
157-
// }
158-
159-
// /**
160-
// * @param array<Action|ActionGroup> $baseActions
161-
// * @param array $nodes
162-
// * @return array<array>
163-
// */
164-
// protected function formatActionsWithRecords(array $baseActions, array $nodes): array
165-
// {
166-
// $formattedActions = [];
167-
168-
// $this->nodeRecordsCache = array_merge(
169-
// $this->nodeRecordsCache,
170-
// $this->getElquentQuery()
171-
// ->findMany(
172-
// collect($nodes)
173-
// ->pluck('id')
174-
// ->filter()
175-
// ->filter(fn ($id) => !isset($this->nodeRecordsCache[$id]))
176-
// ->values()
177-
// ->all()
178-
// )
179-
// ->keyBy(fn ($record) => $record->getKey())
180-
// ->all()
181-
// );
182-
183-
// foreach ($baseActions as $index => $action) {
184-
// $formattedActions[$index] = [];
185-
186-
// foreach ($nodes as $node) {
187-
// $nodeId = $node['id'];
188-
189-
// // Get or fetch record for this node
190-
// $record = $this->nodeRecordsCache[$nodeId] ?? null;
191-
192-
// $formattedActions[$index] = $action->applyTreeNodeRecord($record, $node);
193-
// }
194-
// }
195-
196-
// return $formattedActions;
197-
// }
198-
199-
// /**
200-
// * Clear all caches - useful when data changes
201-
// */
202-
// public function clearActionCaches(): void
203-
// {
204-
// $this->nodeActionsCache = [];
205-
// $this->nodeRecordsCache = [];
206-
// }
207-
208-
// /**
209-
// * Clear cache for specific nodes
210-
// */
211-
// public function clearNodeActionCache(array $nodeIds): void
212-
// {
213-
// // Clear record cache for specific nodes
214-
// foreach ($nodeIds as $nodeId) {
215-
// unset($this->nodeRecordsCache[$nodeId]);
216-
// }
217-
218-
// // Clear action caches that might contain these nodes
219-
// // This is a simple approach - could be optimized further
220-
// $this->nodeActionsCache = [];
221-
// }
222-
223-
// public function refreshTree(): void
224-
// {
225-
// $this->clearActionCaches(); // Clear action caches when refreshing
226-
// parent::refreshTree();
227-
// }
228-
229123
protected function getElquentQuery(): Builder
230124
{
231125
return parent::getElquentQuery()

src/Livewire/ContentTreeNode.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ class ContentTreeNode extends BaseContentTreeNode
1111
{
1212
protected static bool $showNavigationHeader = false;
1313

14+
protected static bool $skipChildrenIfTableView = false;
15+
1416
public ?string $search = null;
1517

1618
public array $limits = [];

0 commit comments

Comments
 (0)