Commit Graph

9 Commits

Author SHA1 Message Date
Andrey Goncharov
da5856138d Add event emitter to datasource
Reviewed By: LukeDefeo

Differential Revision: D51026560

fbshipit-source-id: 8348c6765633d7eecf0d1c80bc5bbd5af8130298
2023-11-08 02:08:25 -08:00
Andrey Goncharov
b55d730dd7 Integrate filter exceptions with DataTable
Summary: See previous diff for context

Reviewed By: LukeDefeo

Differential Revision: D47472005

fbshipit-source-id: 6e7d8873d275f826c38fab16c72e1621fd2784e1
2023-07-18 05:25:59 -07:00
Andrey Goncharov
8397b2bab8 Add filter exceptions to DataSource
Summary: Filter exceptions allow us to add singular items to table views. Extremely useful for Bloks Debugger where we have to jump between multiple types of rows that could be filtered out

Reviewed By: LukeDefeo

Differential Revision: D47472006

fbshipit-source-id: 74d21a65d364ec5ab88652effc06aade20ad80b2
2023-07-18 05:25:59 -07:00
Michel Weststrate
c8776175c3 Added support for secondary indices for fast lookups
Summary:
Add support for secondary indices, to allow for cheap lookups, like a set of events for a specific UI element in the events table:

```

#### getAllRecordsByIndex

Usage: `getAllRecordsByIndex({ indexedAttribute: value, indexAttribute2: value2, .... })`

This method allows fast lookups for objects that match specific attributes exactly.
Returns all items matching the specified index query.
Note that the results are unordered, unless
records have not been updated using upsert / update, in that case
insertion order is maintained.
If no index has been specified for this exact keyset in the indexQuery (see options.indices), this method will throw.

Example:
```

```
const ds = createDataSource([eatCookie, drinkCoffee, submitBug], {
  key: 'id',
  indices: [
    ['title']
    ['id', 'title'],
    ['title', 'done'],
  ],
});

// Find first element with title === cookie (or undefined)
const todo = ds.getFirstRecordByIndex({
    title: 'cookie',
})

// Find all elements where title === cookie, and done === false
const todos = ds.getAllRecordsByIndex({
  title: 'cookie',
  done: false,
})
```

Reviewed By: antonk52

Differential Revision: D47396435

fbshipit-source-id: 20c4527be83532863b9b07ab20ebf20a80c3c35d
2023-07-14 07:46:52 -07:00
Anton Kastritskiy
ff6b0043c4 avoid creating a copy of an array of entire view to look up index
Summary: What title says

Reviewed By: lblasa

Differential Revision: D46275672

fbshipit-source-id: 65c6566a042b576b83ababdf6470ddf2f626d3e4
2023-05-30 08:01:18 -07:00
Anton Kastritskiy
6c84732742 extract get view index into data source view method
Reviewed By: ivanmisuno

Differential Revision: D46224361

fbshipit-source-id: 193becb59eee469ba3e68611e588671947406f7e
2023-05-26 11:55:11 -07:00
Anton Kastritskiy
fda21e96e8 Update typescript to 4.9.5
Reviewed By: passy

Differential Revision: D46068908

fbshipit-source-id: 4c1ffff8690eec5a10c67d6c5d1aacf224e0f0d4
2023-05-23 03:15:10 -07:00
Andrey Goncharov
ff85744911 Make DataView report window changes
Summary: Project: https://docs.google.com/document/d/1x-1ShlxXCM2od9JMO6PP14Cuqq0OrVe1Qd7FUwTos9A/edit

Reviewed By: antonk52

Differential Revision: D44748055

fbshipit-source-id: 409c272b12fb29c156efdaa1ab26d4d6a2936645
2023-04-06 10:10:34 -07:00
Andrey Goncharov
97b8b8a1c4 Split flipper-plugin package
Summary:
flipper-server-companion depends on flipper-plugin. flipper-plugin includes dependencies that run only in a browser. Splitting flipper-plugin into core and browser packages helps to avoid including browser-only dependencies into flipper-server bundle.
As a result, bundle size could be cut in half. Subsequently, RSS usage drops as there is twice as less code to process for V8.

Note: it currently breaks external flipper-data-source package. It will be restored in subsequent diffs

Reviewed By: lblasa

Differential Revision: D38658285

fbshipit-source-id: 751b11fa9f3a2d938ce166687b8310ba8b059dee
2022-09-15 10:02:19 -07:00