Skip to content

Commit

Permalink
make publish function in LiveProvider optional
Browse files Browse the repository at this point in the history
  • Loading branch information
umutzd committed Dec 1, 2021
1 parent f7cff4e commit 7af616a
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 6 deletions.
2 changes: 1 addition & 1 deletion packages/core/src/contexts/live/ILiveContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { LiveEvent } from "../../interfaces";

export type ILiveContext =
| {
publish: (event: LiveEvent) => void;
publish?: (event: LiveEvent) => void;
subscribe: (options: {
channel: string;
params?: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/data/useCreate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ export const useCreate = <
console.log("query, ", query);
});

liveContext?.publish({
liveContext?.publish?.({
channel: `resources/${resource}`,
type: "created",
payload: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/data/useDelete.ts
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ export const useDelete = <
type: "success",
});

liveContext?.publish({
liveContext?.publish?.({
channel: `resources/${resource}`,
type: "deleted",
payload: {
Expand Down
2 changes: 1 addition & 1 deletion packages/core/src/hooks/data/useUpdate.ts
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,7 @@ export const useUpdate = <
type: "success",
});

liveContext?.publish({
liveContext?.publish?.({
channel: `resources/${resource}`,
type: "updated",
payload: {
Expand Down
2 changes: 0 additions & 2 deletions packages/supabase/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -210,8 +210,6 @@ const liveProvider = (supabaseClient: SupabaseClient): LiveProvider => {
unsubscribe: (subscription: RealtimeSubscription) => {
subscription.unsubscribe();
},

publish: () => ({}),
};
};

Expand Down

0 comments on commit 7af616a

Please sign in to comment.