refactor(client): rename the host provide source to provideInfo
This commit is contained in:
@@ -90,7 +90,7 @@ function useAbsentSnapshot<S>(_selector: (snapshot: never) => S, _equal?: (a: S,
|
||||
*/
|
||||
export function SessionMaybeProvider({ children }: { children: ReactNode }) {
|
||||
const host = useHost()
|
||||
const info = observableHook(host.sessions.provide)(s => s)
|
||||
const info = observableHook(host.sessions.provideInfo)(s => s)
|
||||
return (
|
||||
<BindingContext.Provider value={info}>
|
||||
{children}
|
||||
@@ -115,7 +115,7 @@ export interface SessionProviderProps {
|
||||
*/
|
||||
export function SessionProvider({ empty, children }: SessionProviderProps) {
|
||||
const host = useHost()
|
||||
const info = observableHook(host.sessions.provide)(s => s)
|
||||
const info = observableHook(host.sessions.provideInfo)(s => s)
|
||||
const id = info.sessionId
|
||||
if (id === undefined) return <>{empty?.() ?? null}</>
|
||||
return (
|
||||
|
||||
@@ -36,7 +36,7 @@ function hostOver(core: SlotCore): SlotRendererHost {
|
||||
storeOf: () => undefined,
|
||||
sessions: {
|
||||
list: { getSnapshot: () => ({}), subscribe: () => () => {} },
|
||||
provide: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
|
||||
provideInfo: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
|
||||
},
|
||||
workspaces: {
|
||||
list: { getSnapshot: () => ({}), subscribe: () => () => {} },
|
||||
|
||||
@@ -126,7 +126,7 @@ function makeHost() {
|
||||
},
|
||||
sessions: {
|
||||
list,
|
||||
provide,
|
||||
provideInfo: provide,
|
||||
},
|
||||
workspaces: { list: workspaces },
|
||||
}
|
||||
|
||||
@@ -26,7 +26,7 @@ function observable<T>(initial: T) {
|
||||
}
|
||||
|
||||
/**
|
||||
* Minimal host: SessionProvider only reads sessions.provide, but it must
|
||||
* Minimal host: SessionProvider only reads sessions.provideInfo, but it must
|
||||
* render inside the renderer tree (HostContext), so the harness mounts a real
|
||||
* root entry whose body is the test's render-prop provider.
|
||||
*/
|
||||
@@ -51,7 +51,7 @@ function makeHost(bodies: { root: (rp: (key: string, owner: object) => React.Rea
|
||||
storeOf: () => undefined,
|
||||
sessions: {
|
||||
list: observable<unknown>({ ids: [] }),
|
||||
provide,
|
||||
provideInfo: provide,
|
||||
},
|
||||
workspaces: { list: observable<unknown>({ items: [] }) },
|
||||
}
|
||||
|
||||
@@ -40,7 +40,7 @@ function makeHost() {
|
||||
storeOf: () => undefined,
|
||||
sessions: {
|
||||
list: { getSnapshot: () => ({}), subscribe: () => () => {} },
|
||||
provide: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
|
||||
provideInfo: { getSnapshot: () => absentInfo, subscribe: () => () => {} },
|
||||
},
|
||||
workspaces: {
|
||||
list: { getSnapshot: () => ({}), subscribe: () => () => {} },
|
||||
|
||||
Reference in New Issue
Block a user