Skip to content

Commit

Permalink
Fix small things after PR feedback
Browse files Browse the repository at this point in the history
These are minor but do improve the code
  • Loading branch information
mleray committed Jan 24, 2025
1 parent 96ff7bf commit ed44cc0
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 11 deletions.
6 changes: 1 addition & 5 deletions assets/src/block-editor/TermSelector/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@ const DEFAULT_QUERY = {
};

const MIN_TERMS_COUNT_FOR_FILTER = 8;

const EMPTY_ARRAY = [];

/**
Expand All @@ -51,10 +50,6 @@ export function sortBySelected(termsTree, terms) {
const termASelected = treeHasSelection(termA);
const termBSelected = treeHasSelection(termB);

if (termASelected === termBSelected) {
return 0;
}

if (termASelected && !termBSelected) {
return -1;
}
Expand All @@ -65,6 +60,7 @@ export function sortBySelected(termsTree, terms) {

return 0;
};

const newTermTree = [...termsTree];
newTermTree.sort(termIsSelected);
return newTermTree;
Expand Down
2 changes: 1 addition & 1 deletion src/Controllers/Menu/ArchiveImport.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public function get_page(): string

//phpcs:disable
echo 'Peak memory usage: ' . $this->readable_bytes(memory_get_peak_usage());
echo "Total: $total<br/>";
echo 'Total: ' . $total . '<br/>';
echo 'Existing or duplicate: ' . count($existing) . '<br/>';
echo 'Created:: ' . count($created) . '<br/>';
echo 'Errors(' . count($errors) . '): ' . print_r($errors, true) . '<br/>';
Expand Down
6 changes: 2 additions & 4 deletions src/Loader.php
Original file line number Diff line number Diff line change
Expand Up @@ -129,8 +129,7 @@ private function load_services(array $services): void
$this->default_services[] = Importer::class;
}

$view = new View();
(new Controllers\Menu\ArchiveImport($view))->load();
(new Controllers\Menu\ArchiveImport(new View()))->load();
}

// Run Activator after theme switched to planet4-master-theme or a planet4 child theme.
Expand Down Expand Up @@ -178,9 +177,8 @@ private function load_block_services(): void
$services[] = Controllers\Menu\PostmetaCheckController::class;
$services[] = Admin\Rest::class;

$view = new View();
foreach ($services as $service) {
(new $service($view))->load();
(new $service(new View()))->load();
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/MasterSite.php
Original file line number Diff line number Diff line change
Expand Up @@ -344,9 +344,9 @@ function (): void {
$remove_rtl_fix();
add_action('wpml_after_startup', $remove_rtl_fix, 10, 0);

AuthorPage::hooks();
BreakpointsImageSizes::hooks();
QueryLoopPagination::hooks();
AuthorPage::hooks();
Search\Search::hooks();
Sendgrid::hooks();
}
Expand Down

0 comments on commit ed44cc0

Please sign in to comment.