Summary:
Found that one of the parameters wasn't used for anything making
it harder to make sense of the construct and test it.
Reviewed By: nikoant
Differential Revision: D27117591
fbshipit-source-id: f4c796dd37b0bd75497710fb9f88c923181f90e1
Summary:
Not fatal errors and actually very, very high-firing. Something about
the serialisation here is wrong so I can't tell the exactly number right now.
Reviewed By: priteshrnandgaonkar
Differential Revision: D27117067
fbshipit-source-id: d9ce8c736ca2228acedeadeb2e7ee6744d766265
Summary: We're passing around PathBufs where Paths are enough and more efficient.
Reviewed By: fabiomassimo
Differential Revision: D27155300
fbshipit-source-id: cdf8d67e28a669130482d333c960d100bdaf0992
Summary:
Electron 12 renamed one .so and broke the build.
Time to implement T83339637.
Reviewed By: fabiomassimo
Differential Revision: D27155174
fbshipit-source-id: a034f79cacb5c27b62cc6b51c9899a3d3a227954
Summary: Just bumping everything before making changes as ever.
Reviewed By: fabiomassimo
Differential Revision: D27155175
fbshipit-source-id: b6bce17e55e62b901be710099a43b1185e893ed8
Summary: This diffs refactors tsc projects structure and structure of our custom typings to allow producing typescript typings for "flipper" package. In next diffs I'm going to use the produced typings to check compatibility of plugins with certain versions of Flipper, e.g. to check whether plugin is compatible with current "stable" and "insiders" version.
Reviewed By: passy
Differential Revision: D26997158
fbshipit-source-id: a0416c7139bf08ec9d175730da4c4c2a8768eeb7
Summary: See D27047041 (d293b2b0e5) for more details. This diff makes sure the log listener is disposed if the Logs plugin is disabled / the logging is paused, rather than keeping the connection open all time.
Reviewed By: nikoant
Differential Revision: D27083966
fbshipit-source-id: 6f157c237519a0fde9591f1c2033621858863de0
Summary:
Use Logs2 plugin now as the default logs plugin (by overwriting it).
See the rest of this stack
Changelog: The device logs plugin has been fully rewritten. It is faster and more reponsive, formats urls and json, and supports line wrapping and text selection. Beyond that it is now possible to sort and filter on all columns and pause and resume the log stream.
Reviewed By: nikoant
Differential Revision: D27048528
fbshipit-source-id: e18386fec6846ac3568f33a3578f4742213ecaca
Summary:
Flipper used to always subscribe to the adb logs. This change makes the log subscription lazy, which means if there are no plugins listening to the logs, we don't subscribe to the adb logs at all. As you can see in the recording (prod build) this lowers CPU usage significantly: without logs plugin disabled it is now ~5-8 %, with the plugin enabled ~12-18%. Before this change we would never stop listening to the log output, even when the plugins were disabled, causing a constant background noise which people complain regularly about.
The pause / resume button in the new log plugin will now cleanup the connection as well, so that a simple 'pause' click will already boost performance, without needing to disable the logs plugin (if crash reporter is not enabled)
In this diff we also will clear the logs when reconnected. Previously we didn't reset the logs after connecting, we means Flipper would try to gets up with all past logs first, which could be a few 100 K entries.
Further future optimizations could involve using logcat smarter; by actually passing filters on app or loglevel to the command (not sure if that is actually faster, or just a convenience api that does the same filtering as we do)
Changelog: Flipper will now use less CPU if logs & crash reporter plugins are disabled by no longer tailing adb logcat.
Reviewed By: nikoant
Differential Revision: D27047041
fbshipit-source-id: 251a04dcc6f488f220cb56fe50a26788d795e38c
Summary:
Performance fine tuning.
Did some performance fine-tuning primarily by creating a production build, and verifying the responsiveness of searching, tailing etc in the logs plugin while generating a lot of load, and finetuned based on that. For example stopped using requestAnimationFrame which is too sensitive of starving Flipper under high load, as it doesn't leave room for other events to be processed. Also made scrolling smoother by making an append 'high prio' update while taililng.
Also debounced changing the (search) filters, as that is an expensive operation we don't want to trigger on every key press
Reviewed By: passy
Differential Revision: D27046726
fbshipit-source-id: c3efe59eb26e2d9e518325d85531a0e4a6b245ca
Summary: `onRegisterDevice` device abstraction was only used by the CrashReporterPlugin, and since with Sandy plugin lifecycles every plugin can do 'on-load' logic, we don't need it anymore.
Reviewed By: priteshrnandgaonkar
Differential Revision: D27046711
fbshipit-source-id: 16c567c60ed29a50017d525a2b707ee696a99e62
Summary:
This diff converts the CrashReporter plugin to Sandy. The main driver is that it allows us to fix the connection management of logs in a next diff.
There are few changes to highlight:
* A bunch of the old unit tests are removed, as they primarily verified that persistedState abstraction works, a concept that doesn't exist anymore with Sandy (as a result all the logic in error handling and crash reporter plugin has become a lot more trivial as well)
* Added additional unit tests to verify that the integration with notifications from Sandy, and the integration of crashes in combination with CrashReporter plugin works (this wasn't the case before)
* Plugin errors were always suppressed in production builds of Flipper. However, that makes error reporting pretty pointless in the first place, so enabled it by default, but made it a setting in case this results in too many errors suddenly.
* The integration with clicking OS crash notification -> bringing the user to a sensible place _doesn't_ work, but it didn't work before this diff either, so will address that later
* This doesn't upgrade the Crash reporter UI to sandy yet, will do that later in a separate diff
Changelog: Crash reporter will now report errors triggered from the device / client plugins by default. This can be disabled in settings.
Reviewed By: priteshrnandgaonkar
Differential Revision: D27044507
fbshipit-source-id: 8233798f5cce668d61460c948c24bdf92ed7c834
Summary: Exposed the `pluginKey` to sandy plugins (which we will use later for storing table preferences per plugin). And a little moving code around because circular deps problem roared its ugly head again.
Reviewed By: nikoant
Differential Revision: D27009721
fbshipit-source-id: 7ad29e72ff8028c9daae270c4749b657bd8ff049
Summary:
This diff is primarily cosmetic, just pushing code around to make the API more intuitive. Most importantly, DataSource was split into DataSource and DataSourceView classes, the latter being accessible through `datasource.view`.
The benefit of this is two fold:
1. Conceptually it is much clearer now which operations operate on the _source_ records, and which ones on the derived _view_.
2. This will make it easier in the future to support multiple views to be based on a single data source.
This refactoring also nicely found 2 cases where datasource logic and view logic were mixed.
The only semantic change in this diff is that both DataSource and DataSourceView are now iterable, so that one can do a `for (const record of ds)` / `for (const record of ds.view)`
Reviewed By: nikoant
Differential Revision: D26976838
fbshipit-source-id: 3726e92b3c6ee3417dc66cbbe6e288797eecf70e
Summary: Make sure that DataSources can be serialized directly with a single setting, just like plain state atoms
Reviewed By: nikoant
Differential Revision: D26944954
fbshipit-source-id: 2b0d625d7d67f27a7c2e33dd7c4b534dfa4d3e82
Summary:
Noticed in the previous diff that shift is relatively slow for sorted datasources, the reason is that it needs to do a lot of binary searches, and binary search / sorting a full data set is roughly ~20 times slower than resorting a full set, and we're dropping 10% of the data in our test. So if we are shifting too many items in a sorted set, we instead fall back to a rebuild (for non-sorted, shift is super fast because we only drop a bunch of items from the start).
Also solved some more perf related todo's, or made notes about them.
Reviewed By: nikoant
Differential Revision: D26913144
fbshipit-source-id: ee1c04fda1730653affdede0ad22da795e19c2af
Summary:
Added some performance tests for DataSource. Currently simply using jest to run them in a single run, so that is not the most isolated setup (we do GC between tests), but helps to find some global trends at least.
For every scenario two datasets are used, one of 100.000 items, and one of 200.000 items, to verify that all important functions scale roughly linearly or better.
The `append` and `update` test cases perform 1000 insertions / updates. All other tests are singular.
The keyed vs unkeyed variation verifies that we don't drop performance if we maintain a by-key lookup table.
The sorted variations start with an initially already sorted and filtered setup. This nicely show that the datasource really starts to shine with its insertion sort versus full reallocating and sorting
The reference fake implementation does what we do in most cases in Flipper: shallow clone and allocate an entirely new array to append / update data to preserve immutability. Its comparison is pretty terribly, especially considering that in the perf tests we 'render' only once, skewing the stats in favor of the fake implementation: only at the end of the entire batch of updates we sort & filter once (so after inserting a thousand items for example).
In contrast the datasource tests will keep its data sorted at all times, so 'rendering' is already included in the measurements. For the fake datasource, resorting the full 200K rows after each insert would pretty much put bitcoin caused global warming to shame. Also note that the increased GC pressure isn't incorporated in the fake implementation, as we GC outside the measurements.
Reviewed By: nikoant
Differential Revision: D26913145
fbshipit-source-id: 955f1923dce40997cd2e81ea9e80832c6e71c99c
Summary: This diff implements the shift operation, which removes (efficiently) the first (oldest) N records from the datasource. Also implemented a `limit` option to truncate automatically and limit memory usage
Reviewed By: nikoant
Differential Revision: D26883673
fbshipit-source-id: c5ebaf2a327d56cbbe38280c6376c833bcf68b8c
Summary: Implemented `remove`, which, for a typical data source should not be needed. But that would be famous last words and wanted to prevent painting ourselves in a corner, so implemented it. Also because part of the logic is need for the `shift` operation (see next diff), which is much more important.
Reviewed By: priteshrnandgaonkar
Differential Revision: D26883672
fbshipit-source-id: 0dbfcdd3d5a16c4a2d53b0272000d183c67d0034
Summary: ..and some earlier reviews comments has been processed + some fine tuning on the ui
Reviewed By: priteshrnandgaonkar
Differential Revision: D26816559
fbshipit-source-id: adf2586763be185ee8e7cc22b2827ecefe4e4cab
Summary:
This diff implements the remaining features in the logs plugin:
- deeplinking
- merging duplicate rows
The logs plugin source code has now been reduced from originally `935` to `285` LoC. All optimisation code has been removed from the plugin:
* debouncing data processing
* pre-rendering (and storing!) all rows
Finally applied some further styling tweaks and applied some renames to DataTable / DataSource + types finetuning. Some more will follow.
Fixed a emotion warning in unit tests which was pretty annoying.
Reviewed By: passy
Differential Revision: D26666190
fbshipit-source-id: e45e289b4422ebeb46cad927cfc0cfcc9566834f
Summary:
Added styling / coloring to the new logs plugin, to bring it closer to feature completeness. Made the colum headers slightly more compact
Also made the API more foolproof by introducing the `useAssertStableRef` hook, that will protect against accidentally passing in props that would invalidate rendering every time.
Reviewed By: passy
Differential Revision: D26635063
fbshipit-source-id: 60b2af8db3cc3c12d8d25d922cf1735aed91dd2c
Summary:
Per title. Give the user some feedback on why he doesn't see any records (filtering to aggressive vs there are simply no records).
Fixes the old Flipper behavior where tables are merely empty, which always looks kinda broken to me. (Didn't it work, or is there nothing?)
Reviewed By: nikoant
Differential Revision: D26611173
fbshipit-source-id: 7ac798bd7d5c31f6d9fbacf30c6727d2e0e94570
Summary:
This diff has some jak-shaving UX improvements after playing with the DataTable a bit more:
Selection
* deselecting a row from a larger set will make the last selected item the default selection
* re-selecting an item in a single selection will unselect it
Column Filtering
* Introduced button to toggle between filtering on all, nothing, and the values present in the current selection
Column sorting
* The up / down arrows are now inidividually clickable, rather than action as a general toggle
* Title still works as a general toggle between asc / desc / not sorted
Context menu
* I found the context menu for column selection and on the selected rows itself a bit finicky to find and click and not super intuitive for noob users. Merged both menus instead into a single hamburger menu adjacent to the search bar
Reviewed By: passy
Differential Revision: D26580038
fbshipit-source-id: 220f501a1d996acbd51088c08ea866caed768572
Summary:
Make sure DataTable supports multiselection, which works largely the same as before, with a few changes
* shift + click and ctrl + click work as expected
* shift + keyboard navigation works as expected
* drag selection works as expected
* drag selection when dragging accross screens, or Shift icmw with HOME / END / PageUp / PageDown works as expect
* text selection stil works as expected
The context menu items have been updated as well
* filter will filter on all the distinct values in the selection
* copying cells will copy all cells of the given column in the selection, separated by newline
* copying rows / creating a past will create a json array of the selection
Not done yet
- Shifting the selection after inserting rows hasn't been implemented yet
- I'm not entirely happy with the context menu trigger, maybe a hamburger button in the toolbar will be better
Reviewed By: nikoant
Differential Revision: D26548228
fbshipit-source-id: 5d1cddd6aad02ce9649d7980ab3a223e222da893
Summary:
Introduced a context menu for DataTable with some default options. Opted to put it under a visible hovered dropdown instead of on right-click, since this better alings with Ant's design guides (we don't have context clicks anywhere else I think), but if it isn't convincing we can still change it.
Included some default actions, to set up quick filters, and to copy values. For copying rows, implemented it to by default take the JSON from a row, rather than space separated values like in ManagedTable, as many existing plugins customize the onCopy handler to just do that, so it seemed like a better default since it is a richer format. If there are good use cases for the previous behavior, we'll probably find out after the old release :)
Introduced utility to copy text to clipboard in FlipperLib, but decoupled it from Electron.
Didn't include multi select yet, that will be done in a next diff.
Reviewed By: nikoant
Differential Revision: D26513161
fbshipit-source-id: b2b1b20b0a6f4ada9de2566bf6b02171f722c4aa
Summary:
Beyond a search across all columns, it is now possible to specific columns for specific values:
* for a row to be visible, all active column filters need to be matched (e.g. both a filter on time and app has to be satisfied)
* if multiple values within a column are filtered for, these are -or-ed.
* if no value at all within a column is checked, even when they are defined, the column won't take part in filtering
* if there is a general search and column filters, a row has to satisfy both
Filters can be preconfigured, pre-configured filters cannot be removed.
Reseting will reset the filters back to their original
Move `useMemoize` to flipper-plugin
Merged the `ui/utils` and `utils` folder inside `flipper-plugin`
Reviewed By: nikoant
Differential Revision: D26450260
fbshipit-source-id: 11693d5d140cea03cad91c1e0f3438d7b129cf29
Summary: Show a hint during scrolling of the relative offset the user is looking at. This is based on the current virtualisation window, so not 100% accurate, but probably still provides the right signal to the user. See the bottom right of the recording
Reviewed By: nikoant
Differential Revision: D26450261
fbshipit-source-id: 206a860024e346c6b872edc3fc7919019046a6d7
Summary: Introduced search bar and support for custom buttons therein.
Reviewed By: nikoant
Differential Revision: D26338666
fbshipit-source-id: e53cd3c4381e11f5f90c05c92e39a6c8ac2eca65
Summary:
Add support for resizable columns, column sorting, and hiding / showing columns
Moved some utilities from Flipper to flipper-plugin, such as Interactive and LowPassFilter
Split DataTable into two components; DataSourceRenderer which takes care of purely rendering the virtualization, and DataTable that has the Chrome around that, such as column headers, search bar, etc.
Reviewed By: nikoant
Differential Revision: D26321105
fbshipit-source-id: 32b8fc03b4fb97b3af52b23e273c3e5b8cbc4498
Summary:
First rudementary setup of DataTable component that follows a data source. Initially used react-virtuose library, but it performed really badly by doing expensive layout shifts and having troublesome scroll handling. Switched to react-virtual library, which is a bit more level, but much more efficient, and the source code is actually understandable :)
Features:
- hook up to window events of datasource
- high and low prio rendering, based on where the change is happening (should be optimized further)
- sticky scrolling support
- initial column configuration (custom rendering, styling, columns etc will follow in next diffs)
Reviewed By: nikoant
Differential Revision: D26175665
fbshipit-source-id: 224be13b1b32d35e7e01c1dc4198811e2af31102
Summary: This diff introduces the possibility to subscribe to the `output` set of the datasource. It emits three possible event: `reset`, `update`, `shift`.
Reviewed By: jknoxville
Differential Revision: D26100104
fbshipit-source-id: b5fac2289206fab9fb8a437b96ab84034a8b5832
Summary:
Context: https://fb.workplace.com/notes/470523670998369
Per title, also restructured internal logic so that only on intermediate data structure is needed: `output`. This is because we don't need store filter information because we can run that plainly, on the incoming events without storing anything. Sorting is performed directly on `output`. Reverse isn't performed at all, but rather applied lazily when requesting a specific item (so it isn't reflected in output)
Reviewed By: nikoant
Differential Revision: D25976469
fbshipit-source-id: 777f8fdeba09729e19c97c176525b702066b6c2e
Summary:
clear will drop all current records but keep any view preferences. This typically relates to the "clear" button in Flipper.
reset on the other hand will keep the current records, but just reset the view preferences to the default, dropping any filters and sorting criteria
Reviewed By: nikoant
Differential Revision: D25975612
fbshipit-source-id: 5b419f259bffc049daf125090c6754aa6528919b
Summary:
For context see https://fb.workplace.com/notes/470523670998369
This diff adds support for reversing the data collection (in a table this would be used to toggle between ascending and descending sorting). The actual implementation is cleaned up in next diffs and the intermediate collection introduced here is dropped, so this diff is basically only about the unit tests, the implementation is not interesting at this point.
Reviewed By: nikoant
Differential Revision: D25975353
fbshipit-source-id: 2da6da2ed940c2e49e1986696d9b93a7b984db9b
Summary:
For context see https://fb.workplace.com/notes/470523670998369
This diff adds the capability to apply a sorting, and inserts item in a sorted way using binary search in a temporarily intermediate collection. (That collection is optimized away in later diffs, so it is mostly the idea and the tests that are interesting)
Reviewed By: nikoant
Differential Revision: D25953336
fbshipit-source-id: a51b05e25242f0835280ada99798676311511ef0
Summary:
For context see https://fb.workplace.com/notes/470523670998369
This diff introduces the DataSource abstraction, that can store records. If a key is set a key -> record mapping is stored, to make it easy to update existing records using `upsert`, without knowing their exact index.
Internal storage will be slightly altered in upcoming diffs, so don't pay to much attention to that part.
Reviewed By: nikoant
Differential Revision: D25953337
fbshipit-source-id: 1c3b53a2fcf61abaf061946be4af21d2aecc6c6d
Summary:
Bumps core from 1.1.0 to 1.3.0.
[](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `dependabot rebase` will rebase this PR
- `dependabot recreate` will recreate this PR, overwriting any edits that have been made to it
- `dependabot merge` will merge this PR after your CI passes on it
- `dependabot squash and merge` will squash and merge this PR after your CI passes on it
- `dependabot cancel merge` will cancel a previously requested merge and block automerging
- `dependabot reopen` will reopen this PR if it is closed
- `dependabot close` will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
- `dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
- `dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
</details>
Pull Request resolved: https://github.com/facebook/flipper/pull/2003
Reviewed By: mweststrate
Differential Revision: D26980729
Pulled By: passy
fbshipit-source-id: b4da7e300d582ba38e173f6f2b060fb312e9e610
Summary: Upgrading docusaurus to fix react-dev-utils vulnerability which is a transitive dependency.
Reviewed By: mweststrate
Differential Revision: D27010446
fbshipit-source-id: 3caf73029de57067c6060c34874539079721eb59
Summary: After calling "bundle-all-plugins" locally, "yarn test" is failing with obscure message, because some tests are trying to import built bundles instead of "index.tsx". This diff fixes that.
Reviewed By: passy
Differential Revision: D26986246
fbshipit-source-id: cffe988dc642e2c5d2b2028581cd162350186e0c