Created
October 1, 2015 19:12
-
-
Save LionsAd/86489d226352fecfa0ff to your computer and use it in GitHub Desktop.
Ajax Page State Reducing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/core/modules/big_pipe/big_pipe.module b/core/modules/big_pipe/big_pipe.module | |
index 724cd1c..f1af3a4 100644 | |
--- a/core/modules/big_pipe/big_pipe.module | |
+++ b/core/modules/big_pipe/big_pipe.module | |
@@ -18,8 +18,16 @@ | |
function big_pipe_js_settings_alter(&$settings) { | |
// Store the settings for later usage. | |
if (isset($settings['bigPipeResponseMarker'])) { | |
- \Drupal::service('big_pipe')->setAjaxPageState(isset($settings['ajaxPageState']) ? $settings['ajaxPageState'] : NULL); | |
+ $ajax_page_state = isset($settings['ajaxPageState']) ? $settings['ajaxPageState'] : NULL; | |
+ if ($ajax_page_state) { | |
+ $old_ajax_page_state = \Drupal::service('big_pipe')->getAjaxPageState(); | |
+ \Drupal::service('big_pipe')->setAjaxPageState($ajax_page_state); | |
+ if ($old_ajax_page_state === $ajax_page_state) { | |
+ unset($settings['ajaxPageState']); | |
+ } | |
+ } | |
} | |
+ unset($settings['bigPipeResponseMarker']); | |
} | |
/** |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment