Summary: Added stream interecptor which gets a chance to augment the messages off the wire. Stream interceptor transformations are async and can fail due to network errors so added error state with a retry button. The retry button will just call the function again. I am also handling errors better generally when this method fails unexpectedly, logging more clearly what went wrong and communicating it to the user Did some refactoring of subtree update event to support this Reviewed By: lblasa Differential Revision: D44415260 fbshipit-source-id: a5a5542b318775b641d53941808399a8fa4634d3
29 lines
658 B
TypeScript
29 lines
658 B
TypeScript
/**
|
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
* @format
|
|
*/
|
|
|
|
import {Id, Metadata, StreamInterceptor, UINode} from '../types';
|
|
|
|
export function getStreamInterceptor(): StreamInterceptor {
|
|
return new NoOpStreamInterceptor();
|
|
}
|
|
|
|
class NoOpStreamInterceptor implements StreamInterceptor {
|
|
init() {
|
|
return null;
|
|
}
|
|
|
|
async transformNodes(nodes: Map<Id, UINode>): Promise<Map<Id, UINode>> {
|
|
return nodes;
|
|
}
|
|
|
|
async transformMetadata(metadata: Metadata): Promise<Metadata> {
|
|
return metadata;
|
|
}
|
|
}
|