Commit Graph

7 Commits

Author SHA1 Message Date
Michel Weststrate
1029a6c97c Introduce types for Sandy plugins through code base
Summary:
So far there were 2 types of plugins: `FlipperPlugin` and `FlipperDevicePlugin`. This introduces a third kind: `SandyPluginDefinition`.

Unlike with the old plugins, the export of the module is not directly exposed as the plugin definition. Rather, we use class `SandyPluginDefinition` (instance) that holds a loaded definition and its meta data separately (`PluginDetails`). This means that we don't have to mix in and mutate loaded definitions, and that for unit tests we can avoid needing to provide a bunch of meta data. This also prevents a bunch of meta data existing on two places: on the loaded classes as static fields, and in the meta data field of the loaded class as well. Finally, we can now freely extends the `PluginDetails` interface in flipper, without needing to store it on the loaded classes and we are sure that no naming conflicts are caused by this in the future.

For compatibility with the existing code base, common fields are delegated from the `SandyPluginDefinition` class to the meta data.

Also cleaned up types around plugins a little bit and removed some unnecessary casts.

For all features that reason about plugins in general (such as exports), sandy plugins are ignored for now.

`SandyPluginInstance` is worked out in further diffs

The `instanceof` calls are replaced by a utility function in later diffs.

{F241363645}

Reviewed By: jknoxville

Differential Revision: D22091432

fbshipit-source-id: 3aa6b12fda5925268913779f3c3c9e84494438f8
2020-07-01 09:12:35 -07:00
Pritesh Nandgaonkar
d4680eead9 Support Installation for physical device
Summary: This diff enables the installation for iOS simulators. This also fixes the error view created when there is an error. Right now there is a bug on my machine where idb doesn't detect my physical device. But once it is detected, it will work.

Reviewed By: mweststrate

Differential Revision: D22137831

fbshipit-source-id: b6d6f77318c6baef78c35af73db3969b7dd1b907
2020-06-22 15:58:31 -07:00
Michel Weststrate
d70b620fae Disable render debouncing
Summary:
This change kinda reverts D21690494, which broke the layout plugin.

The layout plugin broken because it's implementation assumes that if `this.props.setPersisted` state is called, those changes are immediately reflected in `this.props.persistedState`. For that to work it means that a render needs to be triggered immediately and synchronously by React.

That is a troublesome assumption (React doesn't actually guarantee this) and very likely to break in the future if implementation details change in React or Redux. However, since this is an assumption here, probably more plugins rely on that behavior, so this diff reverts that change. I'll add it the the component library plan to fundamentally address this.

The next diff will re-introduce debouncing, just at a different code point.

Reviewed By: jknoxville

Differential Revision: D21840282

fbshipit-source-id: af69dbded80aa73dfd6558d7cb0268ea0b1c504a
2020-06-03 06:54:14 -07:00
Michel Weststrate
0da766f27b Make sure inefficient or chatty plugins don't churn too much CPU
Summary:
While profiling the high CPU load of the Analytics plugin, I noticed that most of the time is spend in rendering React. This makes sense as the component sends data very frequently, although it is definitely less efficient than it could be.

As shown in the following profile picture, it is clear that all the cpu churns up due to the amounts of re-renderings caused (every new incoming messages causes the plugin to analyse and process all it's data).

With background plugins, we already made sure that non-active plugins don't eat up all the CPU in React components if they process data inefficiently. Before:

{F238020503}

This change debounces how often we give new state to plugins, so that multiple updates get collapsed if the load becomes to high. After (note that not every 'emit' causes in an expensive render anymore, but that the rendering is now in a separate stack, the only remaining renderer is the debouncer component). After:

{F238020481}

Render stack happens now after a bunch of emits:
{F238021694}

This drops ~130% cpu to 70% cpu in the case of the analytics plugin, see below

Reviewed By: passy

Differential Revision: D21690494

fbshipit-source-id: 299c49c95f20af01e6ee3110b0c39478b3135c43
2020-05-26 04:50:52 -07:00
Michel Weststrate
67412bfb43 Fix scrolling of query items and JSON details view
Summary: This diff fixes the tripple scrollbars in the graphQL plugin, and makes sure scrollbars for the detail panel are properly shown

Reviewed By: jonathoma

Differential Revision: D21177849

fbshipit-source-id: d40173d7e9a45064b608c8d953c7aea47a4acd0f
2020-04-23 03:47:31 -07:00
Pascal Hartig
fc9ed65762 prettier 2
Summary:
Quick notes:

- This looks worse than it is. It adds mandatory parentheses to single argument lambdas. Lots of outrage on Twitter about it, personally I'm {emoji:1f937_200d_2642} about it.
- Space before function, e.g. `a = function ()` is now enforced. I like this because both were fine before.
- I added `eslint-config-prettier` to the config because otherwise a ton of rules conflict with eslint itself.

Close https://github.com/facebook/flipper/pull/915

Reviewed By: jknoxville

Differential Revision: D20594929

fbshipit-source-id: ca1c65376b90e009550dd6d1f4e0831d32cbff03
2020-03-24 09:38:11 -07:00
Anton Nikolaev
863f89351e Yarn workspaces
Summary:
1) moved "sonar/desktop/src" to "sonar/desktop/app/src", so "app" is now a separate package containing the core Flipper app code
2) Configured yarn workspaces with the root in "sonar/desktop": app, static, pkg, doctor, headless-tests. Plugins are not included for now, I plan to do this later.

Reviewed By: jknoxville

Differential Revision: D20535782

fbshipit-source-id: 600b2301960f37c7d72166e0d04eba462bec9fc1
2020-03-20 13:37:41 -07:00