Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Listen for hooks firing within set bounds #405

Open
crstauf opened this issue Feb 16, 2019 · 12 comments · May be fixed by #792
Open

Listen for hooks firing within set bounds #405

crstauf opened this issue Feb 16, 2019 · 12 comments · May be fixed by #792

Comments

@crstauf
Copy link
Contributor

crstauf commented Feb 16, 2019

Implement hook discovery into QM (as discussed on Twitter).

Thinking something like the following:

do_action( 'qm/listen/start', 'label' );

...

do_action( 'foobar' );

...

$foo = apply_filters( 'bar', 0 );

...

do_action( 'qm/listen/stop', 'label' );

The above would result in display of both the foobar action and the bar filter in QM, with some display of the second parameter of the QM action hook (in this example, label).

The purpose of label would be to serve in identification when multiple bounds have been set.

@crstauf
Copy link
Contributor Author

crstauf commented Feb 18, 2019

As I see it, there are two approaches:

  1. Introduce a new QM collector and output
  2. Add feature to hooks collector and output

I'm personally favoring the second option, as it could introduce a pretty nice interface and contextualize the discovery. It's likely more work than option one, but ultimately I think a more cohesive experience.

With option two though, need to also consider that would add additional complexity to a relatively straight forward collector.

@johnbillion I may start on a PR for option one, but definitely interested in your thoughts before I get too far in.

@crstauf
Copy link
Contributor Author

crstauf commented Feb 18, 2019

Hmm, given that the Hooks panel can be filtered, I'm now thinking of a different option:

  1. Introduce a sub-panel

@crstauf
Copy link
Contributor Author

crstauf commented Feb 19, 2019

Submitted PR (#410).

@crstauf
Copy link
Contributor Author

crstauf commented Feb 19, 2019

Instead of a column for counting successive uses, I think I'll change to display like the Template Parts section:

screen shot 2019-02-19 at 11 56 21 am

@crstauf
Copy link
Contributor Author

crstauf commented Feb 21, 2019

Discovered Hooks sub-panel now looks like this:

screen shot 2019-02-21 at 1 44 39 am

@crstauf
Copy link
Contributor Author

crstauf commented Feb 21, 2019

Planning on adding additional info to the notice that shows when using the all hook.

@crstauf
Copy link
Contributor Author

crstauf commented Feb 22, 2019

  • add line(s) of do_action() fire(s) to Label column as .qm-info.qm-supplemental
  • add link to Discovered Hooks panel to all hook performance notice

@crstauf
Copy link
Contributor Author

crstauf commented Feb 22, 2019

Added trace info for the start and stop bounds, but I don't like how it displays:

screen shot 2019-02-21 at 8 00 06 pm

Any suggestions?

@crstauf
Copy link
Contributor Author

crstauf commented Feb 23, 2019

I'm not satisfied with the current integration. Going to rebuild as a separate collector.

@crstauf
Copy link
Contributor Author

crstauf commented Feb 23, 2019

Rebuilt using separate collector and output. 😄

@crstauf
Copy link
Contributor Author

crstauf commented Sep 13, 2019

Man, forgot about this; so cool. 😂

@crstauf
Copy link
Contributor Author

crstauf commented Jul 3, 2023

Still so cool.

@crstauf crstauf linked a pull request Jul 12, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant