Skip to content

Commit e3ca36c

Browse files
committed
Merge commit '8fce8f5fe5ef4b346a14f4de76be3062d171a34d' into release/v1.1.2
2 parents fc5e97b + 8fce8f5 commit e3ca36c

File tree

1 file changed

+4
-8
lines changed

1 file changed

+4
-8
lines changed

src/Cache/Invalidation.php

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,7 @@ public function purge( $key, $event = 'undefined event' ) {
226226
* @param mixed|string|int $id The node entity identifier
227227
* @param string $event The event that caused the purge
228228
*/
229-
public function purge_nodes( $id_prefix, $id, $event = '' ) {
229+
public function purge_nodes( $id_prefix, $id, $event = 'unknown event' ) {
230230
if ( ! method_exists( Relay::class, 'toGlobalId' ) ) {
231231
return;
232232
}
@@ -439,7 +439,7 @@ public function on_saved_term_cb( $term_id, $tt_id, $taxonomy, $update, $args =
439439
$tax_object = get_taxonomy( $taxonomy );
440440

441441
// Delete the cached results associated with this post/key
442-
$this->purge_nodes( 'term', $term->term_id );
442+
$this->purge_nodes( 'term', $term->term_id, 'term_saved' );
443443

444444
$type_name = strtolower( $tax_object->graphql_single_name );
445445

@@ -469,7 +469,7 @@ public function on_deleted_term_relationship_cb( $object_id, $tt_id, $taxonomy )
469469
$tax_object = get_taxonomy( $taxonomy );
470470

471471
// Delete the cached results associated with this post/key
472-
$this->purge_nodes( 'term', $term->term_id );
472+
$this->purge_nodes( 'term', $term->term_id, 'term_relationship_deleted' );
473473
$type_name = strtolower( $tax_object->graphql_single_name );
474474
$this->purge( 'list:' . $type_name, 'term_relationship_deleted' );
475475
}
@@ -495,11 +495,7 @@ public function on_added_term_relationship_cb( $object_id, $tt_id, $taxonomy ) {
495495
}
496496

497497
// Delete the cached results associated with this post/key
498-
$this->purge_nodes( 'term', $term->term_id, 'term_edited' );
499-
500-
$tax_object = get_taxonomy( $term->taxonomy );
501-
$type_name = strtolower( $tax_object->graphql_single_name );
502-
$this->purge( 'list:' . $type_name, 'term_edited' );
498+
$this->purge_nodes( 'term', $term->term_id, 'term_relationship_added' );
503499
}
504500

505501
/**

0 commit comments

Comments
 (0)