Skip to content

[5.x]: GQL asset transform immediately argument #18581

@bastiaanwuisman

Description

@bastiaanwuisman

What happened?

Description

The 'immediately' argument for the GQL transform directive is marked as deprecated with the message '[_Deprecated_] This argument is deprecated and has no effect.' (https://github.com/craftcms/cms/blob/5.x/src/gql/arguments/Transform.php#L75). This was done in 2021 in this commit, which also removes support for $generateNow on Asset urls in general.

That functionality however seems to have been restored in 2022 as $immediately in this commit, and the GQL transform directive clearly supports that argument as well.

There does however seem to be a bug with immediately: false in combination with GQL caching. If you enable GQL caching (which is default) and query for a transformed asset url with immediately: false you get the assets/generate-transform url (as expected). But firing the same GQL request will once again result in the deferred url (because of the GQL caching), even though the transformed file exists at this point. This makes serving the transformed asset on subsequent requests inefficient

Steps to reproduce

Expected behavior

Actual behavior

Craft CMS version

5.9.16

PHP version

No response

Operating system and version

No response

Database type and version

No response

Image driver and version

No response

Installed plugins and versions

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions