Sort Result From ID instead of Using Directly from Result
Summary: As mentioned in [the first comment in the Github issue](https://github.com/facebook/flipper/issues/989#issuecomment-616673590), we were mixing database `id` given from client and `index + 1` on server side. After investigating, most are used correctly; it searches `id` from given database `name`. However, there are a few (if not one) that, in my opinion, was used incorrectly. For example, [`tableOption`](https://fburl.com/diffusion/vlo7xbo1) assumed `id - 1` is the index, which is sometime incorrect. This diff sorts the database listed from client by `id` before storing in the state. Changelog: Fixed wrong order assumption on server side Reviewed By: jknoxville Differential Revision: D21496345 fbshipit-source-id: 5e15f776356b0357ac14fbde6c2a11efd76cd1e1
This commit is contained in:
committed by
Facebook GitHub Bot
parent
a3e323c4b5
commit
ee2369950f
@@ -445,7 +445,7 @@ export default class DatabasesPlugin extends FlipperPlugin<
|
|||||||
results: UpdateDatabasesEvent,
|
results: UpdateDatabasesEvent,
|
||||||
): DatabasesPluginState => {
|
): DatabasesPluginState => {
|
||||||
const updates = results.databases;
|
const updates = results.databases;
|
||||||
const databases = updates;
|
const databases = updates.sort((db1, db2) => db1.id - db2.id);
|
||||||
const selectedDatabase =
|
const selectedDatabase =
|
||||||
state.selectedDatabase ||
|
state.selectedDatabase ||
|
||||||
(Object.values(databases)[0]
|
(Object.values(databases)[0]
|
||||||
|
|||||||
Reference in New Issue
Block a user