Use AbstractClient from flipper-frontend-core in fliper-ui-core

Summary: This stack attempts to start using flipper-frontend-core from flipper-ui-core. Currently, flipper-frontend-core contains lots of copy-pasted code from flipper-ui-core.

Reviewed By: lblasa

Differential Revision: D37139198

fbshipit-source-id: 042db7492c550e10ea72c32fd15001c141bf53f9
This commit is contained in:
Andrey Goncharov
2022-06-20 12:18:40 -07:00
committed by Facebook GitHub Bot
parent c2e3c4eb50
commit ef5fa275a3
19 changed files with 251 additions and 596 deletions

View File

@@ -243,11 +243,15 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
selectedAppId =
getAllClients(state).find(
(c) =>
// TODO: Remove after migration
// @ts-expect-error
c.device === payload && c.query.app === state.userPreferredApp,
)?.id ?? null;
// nothing found, try first app if any
if (!selectedAppId) {
selectedAppId =
// TODO: Remove after migration
// @ts-expect-error
getAllClients(state).find((c) => c.device === payload)?.id ?? null;
}
}
@@ -280,7 +284,11 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
return {
...state,
staticView: null,
// TODO: Remove after migration
// @ts-expect-error
selectedDevice: device,
// TODO: Remove after migration
// @ts-expect-error
userPreferredDevice: canBeDefaultDevice(device)
? device.title
: state.userPreferredDevice,
@@ -337,6 +345,8 @@ export default (state: State = INITAL_STATE, action: Actions): State => {
return {
...state,
selectedAppId: payload,
// TODO: Remove after migration
// @ts-expect-error
selectedDevice: client.device,
userPreferredDevice: client.device.title,
userPreferredApp: client.query.app,