Jump to content


  • Posts

  • Joined

  • Last visited

Profile Information

  • Gender
    Not Telling
  • Location

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

charger's Achievements

Full Member

Full Member (4/6)



  1. Here’s the updated code that works for me: <?php namespace ProcessWire; use GraphQL\Type\Definition\Type; $processGraphQL = $modules->get('ProcessGraphQL'); wire()->addHookAfter('ProcessGraphQL::getQueryFields', function ($event) { $query = $event->return; $query[] = [ 'name' => 'hello', 'type' => Type::string(), 'resolve' => function () { return 'world!'; } ]; $event->return = $query; }); echo $processGraphQL->executeGraphQL(); The hook name changed from getQuery to getQueryFields. Also, the new field is now just pushed to the array instead of using the addField() function (from the previous library).
  2. I’m having problems getting the getQuery hook to execute. If I copy-paste the code from https://github.com/dadish/ProcessGraphQL#getquery-hook to graphql.php (or graphiql.php and ready.php for that matter) and just try to log something inside the function, the hook is never executed. @dadish is the documentation still up-to-date in this regard? I’m on PW 3.0.165 and module version 1.3.0
  3. Does anyone know how to get the module to return webp images? see https://processwire.com/blog/posts/webp-images-in-pw/
  4. I could track down the problem to Apollo fragments (specifically using the same fragment more than once in the same query). Not sure why this only popped up inside Repeater fields though. Thanks for the support!
  5. Yes, it is still the same response: no values.
  6. @dadish I’m afraid the problem persists. I get the exact same response. I cleared compiled files and browser cache.
  7. The template permissions are set correctly then. The guest role has view permission on the product template. I’m setting the field permissions not in template context, but per field. So they all have the view permission, also in template context. Just double-checked that. What’s weird is that title and body generally work outside a repeater field. It’s only within the repeater field, that they return no values. Any other ideas?
  8. When trying to fetch Repeater fields with module version 1.0.5, I get responses like this one: [ { "title": "", "body": "", "products": { "list": [], "__typename": "ProductPageArray" }, "__typename": "RepeaterProductGroupsPage" }, { "title": "", "body": "", "products": { "list": [], "__typename": "ProductPageArray" }, "__typename": "RepeaterProductGroupsPage" } ] So I get an answer with the expected data structure (and no errors whatsoever), but the values of the fields are always empty. Also the amount of repeater items in the response matches with the backend. This is when I send the request from the frontend (via Apollo). Looking at the same query within GraphiQL returns the data with the correct values. Could this be a permission problem? I correctly set the access permissions to view for all the fields mentioned in the query.
  9. My idea was to move the logic to get a unique cache name from the server to the client (by setting an ID for a query just like in the linked example) and then use that ID on the server for caching purposes. I was mainly worried that there might be a performance problem with creating hashes from complex queries, but I have no data to back that up.
  10. I implemented a very basic caching strategy for GraphQL queries with the help of PW’s native $cache methods. Here’s how my graphql.php template looks like: <?php namespace ProcessWire; $namespace = 'graphql'; $serializedQuery = file_get_contents('php://input'); $cacheName = hash('md5', $serializedQuery); $cacheData = $cache->getFor($namespace, $cacheName); if (!$cacheData) { $cacheData = $modules->get('ProcessGraphQL')->executeGraphQL(); $cacheSaved = $cache->saveFor($namespace, $cacheName, $cacheData, $expire = 604800); $log->save('graphql', "cache saved $cacheSaved with name $cacheName"); } echo json_encode($cacheData, true); When saving a page in the backend, for now I just clear the whole cache associated with this namespace (inside ready.php ) <?php namespace ProcessWire; $pages->addHookAfter('saveReady', function($event) { $deleted = wire('cache')->deleteFor('graphql'); if ($deleted) wire('log')->save('graphql', 'cache deleted'); }); Serializing the whole query just to get a unique cache name obviously isn’t optimal. How about if the module supported globally unique IDs that could then be used as cache name instead?
  11. @schwarzdesign I’m sorry, but I think I wasn’t specific enough. How does your router.js look like? 🙂 As you say the routing is handled by Vue. However, I wonder how Vue knows about the routes that exist. Do you manually add the routes to router.js? Or do you grab existing routes via API and then include them in the Vue router config?
  12. Thanks for the detailed write-up! Would you mind sharing how exactly you sync the PW routes with Vue router?
  13. I can do that, but you don’t have to set up a new environment. You just grab the PW files and put them in a newly created folder in your webserver’s root.
  14. I was able to solve the problem meanwhile. It was related to my template file structure. I’m using the delayed output strategy together with some nested wireRenderFile() calls which lead to the problem.
  15. The following line in RockPdf.module.php returns a wrong URL if the PW installation lives in a subdirectory (subdirectory is applied twice): 'httpUrl' => rtrim($this->pages->get(1)->httpUrl, '/') . $url,
  • Create New...