Jump to content

Odd bar dump


MarkE
 Share

Recommended Posts

I'm puzzled. Last night I thought I had a nice working pair of hooks - see here: 

 

Today it is not working. I put a bd in the hook before Page::moveable and I get 18 instances of the page being 'page' when viewing the page tree. I put in a bd(Debug::backtrace(), 'backtrace'); and I get another 18 instances of this:

1590074860_Screenshot2024-06-23002222.thumb.png.4b3fc06918d28514229048db732ca89d.png

so the hook seems to be called (only) by Tracy. What is going on?

Link to comment
Share on other sites

7 hours ago, adrian said:

I am really not following what you mean

Sorry - maybe I confused things by providing the context: that was just an explanation as to why I added a bd to the hook (to try and understand how it was being triggered). I was then puzzled that Tracy appears to call it multiple times - in my case 16 exact same repetitions.

7 hours ago, adrian said:

Can you provide a complete example to test?

Try this in ready.php

wire()->addHookBefore('Page::moveable', function(HookEvent $event) {
	$page = $event->object;
	bd($page, 'page');
	bd(Debug::backtrace(), 'backtrace');
});

Then open the page tree. Tracy appears to call the hook multiple times for page id 3 ('page'), but I don't understand why. In my case I got 16 of the dumps illustrated in my OP.

Link to comment
Share on other sites

Tracy's RequestInfo panel has a PagePermissions section which checks the permissions for the current user and each role. One of the permissions it checks is "moveable". If you don't want these calls to happen you can disable this section in Tracy's settings.

image.png.db5cbaf416e368ffcda15a2557d3e92f.png

 

  • Like 2
Link to comment
Share on other sites

14 hours ago, adrian said:

Tracy's RequestInfo panel has a PagePermissions section which checks the permissions for the current user and each role

Thanks @adrian. There's so much in Tracy that I still haven't fully explored. That actually seems a really useful feature. Now I understand why it's called 16 times - because my site has 16 roles (which needs a bit of rationalisation, I think!).

  • Like 1
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...