Do not use custom serializer for all the plugins

Summary:
This diff solves the problem where the export for the graphql plugin was super super super sloooooowwww...... The reason being that the graphql plugin had chunky graphql responses which were json blob which was being serialized by our custom serializer. Instead of serializing those with custom serializer we can directly serialize them as they won't have any map's, sets, classes etc.

This diff adds the two static functions on the plugin which will provide the serialized and deserialized object for the persistedstate. As the plugin knows the structure of its state it can optimize the serialization and deserialization of its data.

This change solves the slow export issue and makes it blazing fast..... 🏎

Bug:

{F206550514}

Reviewed By: danielbuechele

Differential Revision: D17166054

fbshipit-source-id: 058b903c03c12c9194702162c46763ef5b5e7283
This commit is contained in:
Pritesh Nandgaonkar
2019-09-09 06:11:54 -07:00
committed by Facebook Github Bot
parent 9ebf5346df
commit 566f2bf96e
8 changed files with 204 additions and 59 deletions

View File

@@ -94,6 +94,14 @@ declare module 'flipper' {
persistedState: ?PersistedState,
store: ?MiddlewareAPI,
) => Promise<?PersistedState>;
static serializePersistedState: (
persistedState: PersistedState,
statusUpdate?: (msg: string) => void,
idler?: Idler,
) => Promise<string>;
static deserializePersistedState: (
serializedString: string,
) => PersistedState;
static getActiveNotifications: ?(
persistedState: PersistedState,
) => Array<Notification>;