-
Notifications
You must be signed in to change notification settings - Fork 546
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
Always call registry's trigger method from withRegistration #287
Conversation
This is to make it possible to add a runtime hook to trigger, even when the app is running out of debug mode (as TweetDeck does).
@sayrer and I put it behind the debug guard because we were concerned about perf. That's two extra function calls for every trigger, and there can be multiple triggers per click |
If I benchmarked the difference, how much would be unacceptable? |
Almost impossible to answer. What's the use case you need it for? |
Am working on Flight tooling, hooking into I would say it's fine to keep behind debug mode, but TweetDeck can't run in debug mode because we're passing non-seriablizable data around, and we aren't the only ones – the Airbnb search page does it too, and most likely others. Unless there's another way to advice every component's My view is that two, essentially noop, function calls per trigger is fine. |
idea from @kloots: do a this.after('trigger', function() {//...}); |
What's |
your component (just the regular advice pattern) |
There isn't a component here – it's an external tool that hooks into Flight. That's why I need it on the registry – it's the only bit has externally exposed methods that are called with a component's context (from Fwiw, I am actually using advice on |
If you're already using advice to go around trigger(), could you not just have your wrapper for trigger() fire a custom event on the document that could then be listened to by any third party? |
I'm not already using advice to go around trigger – I'm only able to do that when it's exposed and not behind the flag. This PR just makes it possible when the flag is off. |
I'd like to know why you're passing non-serializable data around before we start hacking things up to work around it. |
@sayrer I don't know why we are, but we are. To summarise again: I want a way to hook into every trigger on all components, with arguments. This is possible with If there's an alternate way to do this without a PR, I'm all ears. |
I want to know why Tweetdeck can't use debug mode... this is what it's for. Restating the thread as a demand is a bit facile. |
We have a huge amount of non-Flight code and so in some cases it's simply impractical to use something serializable to get data in and out of that layer. |
Closing as we agreed offline to add the necessary data to the DEBUG global. |
This is to make it possible to add a runtime hook to trigger, even when the app is running out of debug mode (as TweetDeck does).
🚀