We had a chance to try this again and found that adding a host name to the URL allowed us to target views to get our JSON.
The file requirement is only when referencing the URL without a host.
Using a token for the host allows us to deploy to other servers and retain the functionality.
[site:base-url]
https://www.drupal.org/node/3092269 β
Great job on this useful module.
pelicani β created an issue.
pelicani β created an issue.
@catch
Thank you for being so active on this issue with us!
We applied the latest but still got the uncompressed ajax page state in the URL.
Then, @markie found another file to adjust, MediaLibraryState.php and added a change to line 116
if ($query->has('ajax_page_state')) {
$query->remove('ajax_page_state');
}
// Once we have validated the required parameters, we restore the parameters
// from the request since there might be additional values.
$state->replace($query->all());
return $state;
This removed the ajax page state in the url for good.
OMG, yay, w00t, huzzah, giggity!
I've been looking at this for a week and am so ready to NOT be looking at it any more.
@catch
I hear you, that you don't think the issue is in Media Library, but, well, we are still going to poke around in there.
No offense.
In the MediaLibraryUiBuilder.php on line 335 the view request is set...
// Make sure the state parameters are set in the request so the view can
// pass the parameters along in the pager, filters etc.
$view_request = $view_executable->getRequest();
This creates a request parameter for ajax_page_state that does contain the uncompressed libraries that are breaking the URL.
I'm having a hard time removing it.
We set the library to null, but that broke other things.
Good times.
@catch
Thank you for looking at this.
I see the else if is in there, line 354, it's a patch to the patch.
Thanks all.
@catch
Attaching the patch we created from the MR.
https://www.drupal.org/files/issues/2023-09-27/KAL-1754-compress-ajax-pa... β
I'll walk through it today to double check I grabbed the latest changes.
Our issue is the same as reported in
https://www.drupal.org/project/drupal/issues/3348789#comment-15242707
π
Compress ajax_page_state
Fixed
My initial comment is here ...
https://www.drupal.org/project/drupal/issues/3348789#comment-15244675
π
Compress ajax_page_state
Fixed
Better steps to reproduce involve adding a console.log to the ajax.js file.
// If no Ajax callback URL was given, use the link href or form action.
if (!this.url) {
const $element = $(this.element);
if ($element.is('a')) {
this.url = $element.attr('href');
} else if (this.element && element.form) {
this.url = this.$form.attr('action');
}
console.log('url built: '+this.url);
} else {
console.log('url exists: '+this.url);
}
https://www.drupal.org/files/issues/2023-09-27/Screenshot%202023-09-27%2... β
This occurs when we add an image using the media library and filter the images then select one to insert.
On insert, we get the issue.
I hope this is clear, but I can post additional screenshots if necessary.
@aloneblood
Our issue is on a privately hosted environment with no Cloudflare
Thank you for all the work you do.
Thanks @catch,
Applied the MR as a patch for D10.
Only patch that would not apply for D10 was the test in a/core/modules/field_ui/tests/src/Functional/FieldTypeCategoriesIntegrationTest.php because this file does not exist in D10.
all the other patches applied fine.
However, we are still having an issue in the Media Library.
Specifically, in the url, we are seeing compressed ajax_page_state variable, but we are also seeing the uncompressed version for theme and libraries when we insert the image found after filtering.
Note : this only happens after filtering the media library then inserting.
We are now looking at the Media Library to see if it's adding the uncompressed version.
We are having the same issue as reported in
https://www.drupal.org/project/drupal/issues/3348789#comment-15242707
π
Compress ajax_page_state
Fixed
We applied the updated patch in
https://www.drupal.org/project/drupal/issues/3348789#comment-15242845
π
Compress ajax_page_state
Fixed
But now, the Media Modal will not open.
It appears that the array is getting passed and causing a scalar issue.
Thank you for your work on this issue.
Our theme was passing .attributes to the class
The change we apply for 10.1.2 is to pass .attributes.storage to the class instead.
This correctly sends the array instead of the attributes object.
After testing on another site and changing themes, this issue is in our theme, not in core.
Sorry for posting to quickly.
We will figure this out with our theme.
pelicani β created an issue.