Bring back deprecated events temporarily (#2727)

* fix: bring back deprecated events

* chore: update version number
This commit is contained in:
Vinh
2019-11-21 20:04:42 +00:00
committed by Wyatt Johnson
parent 10719bd874
commit ca811a3496
6 changed files with 20 additions and 2 deletions
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "5.3.1",
"version": "5.3.2",
"lockfileVersion": 1,
"requires": true,
"dependencies": {
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "@coralproject/talk",
"version": "5.3.1",
"version": "5.3.2",
"author": "The Coral Project",
"homepage": "https://coralproject.net/",
"sideEffects": [
@@ -38,6 +38,8 @@ function createMutationContainer<T extends string, I, R>(
);
private commit = (input: I) => {
// TODO: (cvle) These events are deprecated.
this.props.context.eventEmitter.emit(`mutation.${propName}`, input);
return commit(
this.props.context.relayEnvironment,
input,
@@ -69,6 +69,8 @@ export function useFetch<V, R>(
const context = useCoralContext();
return useCallback<FetchProp<typeof fetch>>(
((variables: V) => {
// TODO: (cvle) These events are deprecated.
context.eventEmitter.emit(`fetch.${fetch.name}`, variables);
return fetch.fetch(context.relayEnvironment, variables, context);
}) as any,
[context]
@@ -93,6 +95,11 @@ export function withFetch<N extends string, V, R>(
public static displayName = wrapDisplayName(BaseComponent, "withFetch");
private fetch = (variables: V) => {
// TODO: (cvle) These events are deprecated.
this.props.context.eventEmitter.emit(
`fetch.${fetch.name}`,
variables
);
return fetch.fetch(
this.props.context.relayEnvironment,
variables,
@@ -71,6 +71,8 @@ export function useMutation<I, R>(
const context = useCoralContext();
return useCallback<MutationProp<typeof mutation>>(
((input: I) => {
// TODO: (cvle) These events are deprecated.
context.eventEmitter.emit(`mutation.${mutation.name}`, input);
return mutation.commit(context.relayEnvironment, input, context);
}) as any,
[context]
@@ -98,6 +100,11 @@ export function withMutation<N extends string, I, R>(
);
private commit = (input: I) => {
// TODO: (cvle) These events are deprecated.
this.props.context.eventEmitter.emit(
`mutation.${mutation.name}`,
input
);
return mutation.commit(
this.props.context.relayEnvironment,
input,
@@ -50,6 +50,8 @@ export function useSubscription<V>(
const context = useCoralContext();
return useCallback<SubscriptionProp<typeof subscription>>(
((variables: V) => {
// TODO: (cvle) These events are deprecated.
context.eventEmitter.emit(`subscription.${subscription.name}`, variables);
return subscription.subscribe(
context.relayEnvironment,
variables,