Summary:
This wires up tracking directly to the ANT component library for the following components:
1. `Button`
2. `Collapse.Panel`
3. `Tabs`
Other less commonly used elements can be connected in the future if needed.
I played a bit with different patterns, but in testing the patch-package patching give the most reliable results. Alternatives considered:
1. Expect users to explicitly wrap there components, e.g. `<Tracked><Button>Hi</Button></Tracked>`
1. Didn't implement this because it would be very common to forget, and at the moment you want to make some analysis you'll discover there is no interesting data available. I think for tracking we want to have opt-out rather than opt-in
2. The additional wrapping can cause some subtile layout issues due to static field inspection / forwarded refs (e.g. Ant often has an assumption that relevant children types are _directly_ nested under their parent element. For examle `<Tooltip><Tracked><Button>` does not work as expected
2. Expose our own `Button` / `Collapse` / `Tabs` that applies `Tracked` to an underlying Ant component.
1. also suffers from 1.b.
2. It is gonna be quite confusing for other devs that some elements would need to be imported from `flipper-plugin`, ant some from `antd`, and that this is likely to change over time. We could lint against it, but it will be still suboptimal
Reviewed By: jknoxville
Differential Revision: D25196321
fbshipit-source-id: b559356498c3191a283062a88daacb354b0f79f4
26 lines
705 B
Diff
26 lines
705 B
Diff
diff --git a/node_modules/rc-tabs/es/TabNavList/TabNode.js b/node_modules/rc-tabs/es/TabNavList/TabNode.js
|
|
index 2a69e83..e00ada1 100644
|
|
--- a/node_modules/rc-tabs/es/TabNavList/TabNode.js
|
|
+++ b/node_modules/rc-tabs/es/TabNavList/TabNode.js
|
|
@@ -37,10 +37,19 @@ function TabNode(_ref, ref) {
|
|
}
|
|
|
|
var removable = editable && closable !== false && !disabled;
|
|
+ var scope = React.useContext(global.FlipperTrackingScopeContext);
|
|
|
|
function onInternalClick(e) {
|
|
if (disabled) return;
|
|
- onClick(e);
|
|
+
|
|
+ global.flipperTrackInteraction(
|
|
+ 'Tabs',
|
|
+ 'onTabClick',
|
|
+ scope,
|
|
+ 'tab:' + key + ':' + tab,
|
|
+ onClick,
|
|
+ e
|
|
+ );
|
|
}
|
|
|
|
function onRemoveTab(event) {
|