@lunora/react 1.0.0-alpha.241 → 1.0.0-alpha.242
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md
CHANGED
|
@@ -103,7 +103,7 @@ function MessageList({ room }: { room: string }) {
|
|
|
103
103
|
| `useInfiniteQuery(fn, args, { initialNumItems, onError? })` | `{ pages, status, hasNextPage, fetchNextPage, error, … }` | Page-array variant of the same paginator. |
|
|
104
104
|
| `usePreloadedQuery(preloaded, options?)` | `T \| undefined` | Reads a server `Preloaded` token, then goes live. Pass `onError` to see a session expiry instead of rendering the stale SSR snapshot. |
|
|
105
105
|
| `usePresence(roomId, { heartbeat, listPresent, … })` | `{ present, sessionId, setData, error }` | Drives the `definePresence` heartbeat + list functions. `roomId` is a positional first argument, not an option. |
|
|
106
|
-
| `useLiveTopic(options)`
|
|
106
|
+
| `useLiveTopic(topic, options?)` | `{ lastEvent, error }` | Follows one declared live topic over an SSE connection shared by stream route. See the note below the table. |
|
|
107
107
|
| `useFlag(key, default)` | flag value (live) | Live OpenFeature flag over the WS; reads `default` until the server answers. Evaluated under the socket's server-verified identity. |
|
|
108
108
|
| `useFlags(defaults)` | `{ [key]: value }` | Batch variant — one live value per key in the `defaults` map. |
|
|
109
109
|
| `useStream(fn, args, options?)` | `{ chunks, status, error, cancel }` | Consumes a streamed action response chunk by chunk. |
|
|
@@ -119,7 +119,7 @@ function MessageList({ room }: { room: string }) {
|
|
|
119
119
|
|
|
120
120
|
The payment kit — `CheckoutButton`, `CustomerPortalButton`, and `useCheckout`, which wrap `@lunora/payment` flows — ships from the `@lunora/react/payment` subpath, not the package root: it renders a DOM `<button>` and navigates via `globalThis.location`, so it is the one part of this package that is browser-only (the root barrel stays renderer-agnostic, which is what lets `@lunora/react-native` re-export it wholesale).
|
|
121
121
|
|
|
122
|
-
`useLiveTopic(options)` follows one topic
|
|
122
|
+
`useLiveTopic(topic, options?)` follows one topic a `defineLiveStream` declares. Pass the reference `_generated/live.ts` hands out, e.g. `useLiveTopic(live.posts.post({ postId }), { onEvent })`: the stream's route is resolved against the `LunoraClient` from `<LunoraProvider>`, so there is no URL or topic string to write, and `lastEvent` and `onEvent` are typed by the payload the topic declares. The SSE connection is shared by stream route and connection options: hooks with the same route, `shardKey`, `sessionKey`, credentials, headers and retry tuning ride one stream, and it closes after the last one unmounts. `lastEvent` is the last payload delivered on the topic, and `error` is set when the shard refuses the subscription. Options are `onEvent`, `onError`, `shardKey` (follow a `.shardBy` shard, and publish to the same one), `sessionKey` (partitions the shared connection: a changed value opens a new one and closes the old, for example on sign-out; it is never sent to the server), and the transport tuning `headers`, `withCredentials`, `retryDelay`, `maxDelayMs`. Changing `onEvent` or `onError` does not resubscribe. It opens nothing during SSR.
|
|
123
123
|
|
|
124
124
|
`useVoiceAgent` opens nothing until you call `startCall()` — that is what requests the microphone, so it has to run from a user gesture; `endCall()` releases the socket, the mic tracks and the Web Audio graph, and also runs on unmount. See the [voice-agent docs](https://lunora.sh/docs/packages/react#voice-agents--usevoiceagentoptions) for the silence/barge-in thresholds.
|
|
125
125
|
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf,
|
|
2
|
+
import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, LiveTopicOptions, LiveStreamSubscribeError, LiveTopicRef, MutatorHandle, Preloaded } from '@lunora/client';
|
|
3
3
|
export { type ArgsOf, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type ClientQueryRef, type FunctionReference, type HttpStreamArgsOf, type HttpStreamChunkOf, type HttpStreamRef, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type SubscriptionError, type SubscriptionErrorCallback, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-CdgGQ9s4.mjs";
|
|
@@ -953,29 +953,33 @@ declare const usePaginatedQuery: <F extends FunctionReference>(function_: F, arg
|
|
|
953
953
|
* keyset implementation.
|
|
954
954
|
*/
|
|
955
955
|
declare const useInfiniteQuery: <F extends FunctionReference>(function_: F, args: "skip" | PaginatedArgs<F>, options: UseInfiniteQueryOptions) => UseInfiniteQueryResult<PageItemOf<F>>;
|
|
956
|
-
/** Options for {@link useLiveTopic}: the
|
|
957
|
-
type UseLiveTopicOptions =
|
|
958
|
-
interface UseLiveTopicResult {
|
|
956
|
+
/** Options for {@link useLiveTopic}: the transport tuning and callbacks, with the callbacks read through a ref. */
|
|
957
|
+
type UseLiveTopicOptions<Payload = unknown> = LiveTopicOptions<Payload>;
|
|
958
|
+
interface UseLiveTopicResult<Payload = unknown> {
|
|
959
959
|
/** Set when the shard refuses the subscription (403, 409, 429 and similar). */
|
|
960
960
|
error: LiveStreamSubscribeError | undefined;
|
|
961
961
|
/** The last payload delivered on the topic, or `undefined` until the first event. */
|
|
962
|
-
lastEvent:
|
|
962
|
+
lastEvent: Payload | undefined;
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
965
965
|
* `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
|
|
966
|
-
* the component.
|
|
966
|
+
* the component. Pass the reference `_generated/live.ts` hands out
|
|
967
|
+
* (`live.posts.post({ postId })`): the stream's route is resolved against the
|
|
968
|
+
* `LunoraClient` from the nearest `<LunoraProvider>`, and `lastEvent` and `onEvent`
|
|
969
|
+
* are typed by the payload the topic declares.
|
|
967
970
|
*
|
|
968
971
|
* It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
|
|
969
972
|
* shared by URL, so mounting this hook ten times still opens one stream. It
|
|
970
973
|
* subscribes on mount, unsubscribes on unmount, and resubscribes only when the
|
|
971
|
-
* connection inputs (
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
+
* connection inputs (topic, shard, credentials, headers, retry tuning) change.
|
|
975
|
+
* Building the reference inline on every render is fine, since only its content
|
|
976
|
+
* counts. Changing `onEvent` or `onError` identity does not resubscribe — the
|
|
977
|
+
* latest callback is read through a ref.
|
|
974
978
|
*
|
|
975
979
|
* It is a no-op during SSR: effects do not run on the server, so the hook returns
|
|
976
980
|
* its initial values there.
|
|
977
981
|
*/
|
|
978
|
-
declare
|
|
982
|
+
declare function useLiveTopic<Payload>(topic: LiveTopicRef<Payload>, options?: UseLiveTopicOptions<Payload>): UseLiveTopicResult<Payload>;
|
|
979
983
|
type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
|
|
980
984
|
interface MutationHook<F extends FunctionReference> {
|
|
981
985
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ReactNode, ReactElement } from 'react';
|
|
2
|
-
import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf,
|
|
2
|
+
import { LunoraClient, OptimisticUpdate, User, SubscriptionErrorCallback, SubscriptionError, FunctionReference, ArgsOf, ActionCallOptions, ReturnOf, AuthImpersonation, AuthSession, AuthUser, ClientQueryRef, ConnectionStatus, HttpStreamRef, HttpStreamArgsOf, HttpStreamChunkOf, LiveTopicOptions, LiveStreamSubscribeError, LiveTopicRef, MutatorHandle, Preloaded } from '@lunora/client';
|
|
3
3
|
export { type ArgsOf, type AuthImpersonation, type AuthPage, type AuthSession, type AuthUser, type ClientQueryRef, type FunctionReference, type HttpStreamArgsOf, type HttpStreamChunkOf, type HttpStreamRef, type LunoraClient, type LunoraErrorCode, type MutatorHandle, type MutatorTransaction, type OptimisticLocalStore, type OptimisticUpdate, type Preloaded, type ReturnOf, type SubscriptionError, type SubscriptionErrorCallback, type User, createClientQuery, getErrorCode, getRetryAfterMs, isConflictError, isForbiddenError, isRateLimitedError, isUnauthorizedError } from '@lunora/client';
|
|
4
4
|
import { QueryClient } from '@tanstack/react-query';
|
|
5
5
|
export { type L as LunoraQueryOptions, l as lunoraQueryOptions } from "./packem_shared/query-options.d-CdgGQ9s4.js";
|
|
@@ -953,29 +953,33 @@ declare const usePaginatedQuery: <F extends FunctionReference>(function_: F, arg
|
|
|
953
953
|
* keyset implementation.
|
|
954
954
|
*/
|
|
955
955
|
declare const useInfiniteQuery: <F extends FunctionReference>(function_: F, args: "skip" | PaginatedArgs<F>, options: UseInfiniteQueryOptions) => UseInfiniteQueryResult<PageItemOf<F>>;
|
|
956
|
-
/** Options for {@link useLiveTopic}: the
|
|
957
|
-
type UseLiveTopicOptions =
|
|
958
|
-
interface UseLiveTopicResult {
|
|
956
|
+
/** Options for {@link useLiveTopic}: the transport tuning and callbacks, with the callbacks read through a ref. */
|
|
957
|
+
type UseLiveTopicOptions<Payload = unknown> = LiveTopicOptions<Payload>;
|
|
958
|
+
interface UseLiveTopicResult<Payload = unknown> {
|
|
959
959
|
/** Set when the shard refuses the subscription (403, 409, 429 and similar). */
|
|
960
960
|
error: LiveStreamSubscribeError | undefined;
|
|
961
961
|
/** The last payload delivered on the topic, or `undefined` until the first event. */
|
|
962
|
-
lastEvent:
|
|
962
|
+
lastEvent: Payload | undefined;
|
|
963
963
|
}
|
|
964
964
|
/**
|
|
965
965
|
* `useLiveTopic` — follow one live topic of a `defineLiveStream` for the life of
|
|
966
|
-
* the component.
|
|
966
|
+
* the component. Pass the reference `_generated/live.ts` hands out
|
|
967
|
+
* (`live.posts.post({ postId })`): the stream's route is resolved against the
|
|
968
|
+
* `LunoraClient` from the nearest `<LunoraProvider>`, and `lastEvent` and `onEvent`
|
|
969
|
+
* are typed by the payload the topic declares.
|
|
967
970
|
*
|
|
968
971
|
* It is a lifecycle wrapper over `subscribeLiveTopic`: the connection itself is
|
|
969
972
|
* shared by URL, so mounting this hook ten times still opens one stream. It
|
|
970
973
|
* subscribes on mount, unsubscribes on unmount, and resubscribes only when the
|
|
971
|
-
* connection inputs (
|
|
972
|
-
*
|
|
973
|
-
*
|
|
974
|
+
* connection inputs (topic, shard, credentials, headers, retry tuning) change.
|
|
975
|
+
* Building the reference inline on every render is fine, since only its content
|
|
976
|
+
* counts. Changing `onEvent` or `onError` identity does not resubscribe — the
|
|
977
|
+
* latest callback is read through a ref.
|
|
974
978
|
*
|
|
975
979
|
* It is a no-op during SSR: effects do not run on the server, so the hook returns
|
|
976
980
|
* its initial values there.
|
|
977
981
|
*/
|
|
978
|
-
declare
|
|
982
|
+
declare function useLiveTopic<Payload>(topic: LiveTopicRef<Payload>, options?: UseLiveTopicOptions<Payload>): UseLiveTopicResult<Payload>;
|
|
979
983
|
type CallOptions<F extends FunctionReference> = UseMutationCallOptions<unknown, unknown, ArgsOf<F>>;
|
|
980
984
|
interface MutationHook<F extends FunctionReference> {
|
|
981
985
|
/** The latest invocation's resolved value, or `undefined` before the first success. */
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as f,u as n}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as c,useOrganizations as h,useSignUpInvitations as U}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as C}from"./packem_shared/useAgent-C2jMXz2-.mjs";import{useAgentChat as S}from"./packem_shared/useAgentChat-DiBCl0Rr.mjs";import{useAgentState as Q}from"./packem_shared/useAgentState-CDAO3aLL.mjs";import{useAgentToolEvents as R}from"./packem_shared/useAgentToolEvents-Bb94yV7R.mjs";import{default as F}from"./packem_shared/useAuth-CpGKVRsv.mjs";import{default as M}from"./packem_shared/useClientQuery-DUEUAqPh.mjs";import{default as b}from"./packem_shared/useConnectionStatus-Dtx_OWez.mjs";import{useFlag as O,useFlags as k}from"./packem_shared/useFlag-A7XPHExt.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-CzryjxVH.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-D_AG59dX.mjs";import{useLiveTopic as B}from"./packem_shared/useLiveTopic-
|
|
2
|
+
import{AuthLoading as o,Authenticated as t,Unauthenticated as u}from"./packem_shared/AuthLoading-024-XH0I.mjs";import{useAuthState as a}from"./packem_shared/useAuthState-CqN1F2FM.mjs";import{L as f,u as n}from"./packem_shared/lunora-provider-_WqSuvf9.mjs";import{lunoraQueryOptions as m}from"./packem_shared/lunoraQueryOptions-IJB_aFzi.mjs";import{useAction as x}from"./packem_shared/useAction-jJl4KPEw.mjs";import{useAuthSessions as g,useAuthUsers as A,useImpersonate as c,useOrganizations as h,useSignUpInvitations as U}from"./packem_shared/useAuthSessions-jJWdw8Zw.mjs";import{useAgent as C}from"./packem_shared/useAgent-C2jMXz2-.mjs";import{useAgentChat as S}from"./packem_shared/useAgentChat-DiBCl0Rr.mjs";import{useAgentState as Q}from"./packem_shared/useAgentState-CDAO3aLL.mjs";import{useAgentToolEvents as R}from"./packem_shared/useAgentToolEvents-Bb94yV7R.mjs";import{default as F}from"./packem_shared/useAuth-CpGKVRsv.mjs";import{default as M}from"./packem_shared/useClientQuery-DUEUAqPh.mjs";import{default as b}from"./packem_shared/useConnectionStatus-Dtx_OWez.mjs";import{useFlag as O,useFlags as k}from"./packem_shared/useFlag-A7XPHExt.mjs";import{useHttpStream as V}from"./packem_shared/useHttpStream-CzryjxVH.mjs";import{default as q}from"./packem_shared/useInfiniteQuery-D_AG59dX.mjs";import{useLiveTopic as B}from"./packem_shared/useLiveTopic-UYAE2s4R.mjs";import{useMutation as G}from"./packem_shared/useMutation-Bz9uwvGf.mjs";import{useMutator as K}from"./packem_shared/useMutator-BtUd-xEA.mjs";import{usePaginatedQuery as W}from"./packem_shared/usePaginatedQuery-DhQAsxgX.mjs";import{hydratePreloaded as Y,default as Z}from"./packem_shared/hydratePreloaded-qs8nspKB.mjs";import{usePresence as $}from"./packem_shared/usePresence-X5Ax04Cf.mjs";import{default as re}from"./packem_shared/useQuery-CETQat99.mjs";import{useRateLimit as te}from"./packem_shared/useRateLimit-Cckxi8m9.mjs";import{useStream as se}from"./packem_shared/useStream-D8GB__4j.mjs";import{default as pe}from"./packem_shared/useSubscription-CwZgOrE4.mjs";import{useVoiceAgent as ne}from"./packem_shared/useVoiceAgent-DAh27XxD.mjs";import{createClientQuery as me,getErrorCode as de,getRetryAfterMs as xe,isConflictError as le,isForbiddenError as ge,isRateLimitedError as Ae,isUnauthorizedError as ce}from"@lunora/client";import{RestrictionError as Ue,UploadControl as ye,UploadError as Ce}from"@visulima/storage-client";import{useChunkedRestUpload as Se,useFileInput as Le,useMultipartUpload as Qe,usePasteUpload as Pe,useTusUpload as Re,useUpload as ve}from"@visulima/storage-client/react";export{o as AuthLoading,t as Authenticated,f as LunoraProvider,Ue as RestrictionError,u as Unauthenticated,ye as UploadControl,Ce as UploadError,me as createClientQuery,de as getErrorCode,xe as getRetryAfterMs,Y as hydratePreloaded,le as isConflictError,ge as isForbiddenError,Ae as isRateLimitedError,ce as isUnauthorizedError,m as lunoraQueryOptions,x as useAction,C as useAgent,S as useAgentChat,Q as useAgentState,R as useAgentToolEvents,F as useAuth,g as useAuthSessions,a as useAuthState,A as useAuthUsers,Se as useChunkedRestUpload,M as useClientQuery,b as useConnectionStatus,Le as useFileInput,O as useFlag,k as useFlags,V as useHttpStream,c as useImpersonate,q as useInfiniteQuery,B as useLiveTopic,n as useLunora,Qe as useMultipartUpload,G as useMutation,K as useMutator,h as useOrganizations,W as usePaginatedQuery,Pe as usePasteUpload,Z as usePreloadedQuery,$ as usePresence,re as useQuery,te as useRateLimit,U as useSignUpInvitations,se as useStream,pe as useSubscription,Re as useTusUpload,ve as useUpload,ne as useVoiceAgent};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import{c as D}from"react/compiler-runtime";import{liveTopicSubscription as R,subscribeLiveTopic as C}from"@lunora/client";import{stableWireKey as M}from"@lunora/wire";import{useState as W,useRef as $,useEffect as y}from"react";import{u as g}from"./lunora-provider-_WqSuvf9.mjs";function F(b,f){const t=D(8),d=f===void 0?{}:f,o=R(g(),b,d),{headers:k,maxDelayMs:T,retryDelay:K,sessionKey:L,topic:S,url:h,withCredentials:w}=o,e=M({headers:k,maxDelayMs:T,retryDelay:K,sessionKey:L,topic:S,url:h,withCredentials:w}),[p,l]=W(),m=p?.key===e?p:void 0,s=$(o);let n;t[0]!==o?(n=()=>{s.current=o},t[0]=o,t[1]=n):n=t[1],y(n);let i,c;t[2]!==e?(i=()=>{const x=C({...s.current,onError:r=>{l(E=>({error:r,key:e,lastEvent:E?.key===e?E.lastEvent:void 0})),s.current.onError?.(r)},onEvent:r=>{l({error:void 0,key:e,lastEvent:r}),s.current.onEvent?.(r)}});return()=>{x(),l(void 0)}},c=[e],t[2]=e,t[3]=i,t[4]=c):(i=t[3],c=t[4]),y(i,c);const a=m?.error,v=m?.lastEvent;let u;return t[5]!==a||t[6]!==v?(u={error:a,lastEvent:v},t[5]=a,t[6]=v,t[7]=u):u=t[7],u}export{F as useLiveTopic};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@lunora/react",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.242",
|
|
4
4
|
"description": "React hooks for Lunora: useQuery, useMutation, useSubscription, and useAuth",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cloudflare",
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"access": "public"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@lunora/client": "1.0.0-alpha.
|
|
60
|
+
"@lunora/client": "1.0.0-alpha.229",
|
|
61
61
|
"@lunora/errors": ">=1.0.0-alpha.51 <2.0.0-0",
|
|
62
|
-
"@lunora/ratelimit": "1.0.0-alpha.
|
|
62
|
+
"@lunora/ratelimit": "1.0.0-alpha.152",
|
|
63
63
|
"@lunora/wire": "1.0.0-alpha.1",
|
|
64
64
|
"@visulima/storage-client": "1.0.9"
|
|
65
65
|
},
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
import{c as R}from"react/compiler-runtime";import{subscribeLiveTopic as S}from"@lunora/client";import{stableWireKey as T}from"@lunora/wire";import{useState as w,useRef as C,useEffect as D}from"react";const j=r=>{const e=R(16),{headers:a,maxDelayMs:f,retryDelay:v,sessionKey:E,topic:m,url:y,withCredentials:b}=r;let n;e[0]!==a||e[1]!==f||e[2]!==v||e[3]!==E||e[4]!==m||e[5]!==y||e[6]!==b?(n=T({headers:a,maxDelayMs:f,retryDelay:v,sessionKey:E,topic:m,url:y,withCredentials:b}),e[0]=a,e[1]=f,e[2]=v,e[3]=E,e[4]=m,e[5]=y,e[6]=b,e[7]=n):n=e[7];const t=n,[h,d]=w(),p=h?.key===t?h:void 0,o=C(r);let c;e[8]!==r?(c=()=>{o.current=r},e[8]=r,e[9]=c):c=e[9],D(c);let i,l;e[10]!==t?(i=()=>{const L=S({...o.current,onError:s=>{d(x=>({error:s,key:t,lastEvent:x?.key===t?x.lastEvent:void 0})),o.current.onError?.(s)},onEvent:s=>{d({error:void 0,key:t,lastEvent:s}),o.current.onEvent?.(s)}});return()=>{L(),d(void 0)}},l=[t],e[10]=t,e[11]=i,e[12]=l):(i=e[11],l=e[12]),D(i,l);const k=p?.error,K=p?.lastEvent;let u;return e[13]!==k||e[14]!==K?(u={error:k,lastEvent:K},e[13]=k,e[14]=K,e[15]=u):u=e[15],u};export{j as useLiveTopic};
|