Relax the params (#4190)
Feels like we can relax what we expect? It gets passed to `loadSnapshot` which allows for partials. Resolves https://github.com/tldraw/tldraw/issues/3999 ### Change type - [ ] `bugfix` - [x] `improvement` - [ ] `feature` - [ ] `api` - [ ] `other` ### Release notes - Allow passing partial `TLEditorSnapshot` to `TldrawImage` and `useTLStore`.
This commit is contained in:
parent
48d1f4e0d7
commit
e784d3182f
4 changed files with 5 additions and 5 deletions
|
@ -3539,7 +3539,7 @@ export function useTLSchemaFromUtils(opts: TLStoreSchemaOptions): StoreSchema<TL
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
export function useTLStore(opts: TLStoreOptions & {
|
export function useTLStore(opts: TLStoreOptions & {
|
||||||
snapshot?: TLEditorSnapshot | TLStoreSnapshot;
|
snapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot;
|
||||||
}): TLStore;
|
}): TLStore;
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
|
|
@ -11,7 +11,7 @@ import {
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
type UseTLStoreOptions = TLStoreOptions & {
|
type UseTLStoreOptions = TLStoreOptions & {
|
||||||
snapshot?: TLEditorSnapshot | TLStoreSnapshot
|
snapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot
|
||||||
}
|
}
|
||||||
|
|
||||||
function createStore(opts: UseTLStoreOptions) {
|
function createStore(opts: UseTLStoreOptions) {
|
||||||
|
@ -24,7 +24,7 @@ function createStore(opts: UseTLStoreOptions) {
|
||||||
|
|
||||||
/** @public */
|
/** @public */
|
||||||
export function useTLStore(
|
export function useTLStore(
|
||||||
opts: TLStoreOptions & { snapshot?: TLEditorSnapshot | TLStoreSnapshot }
|
opts: TLStoreOptions & { snapshot?: Partial<TLEditorSnapshot> | TLStoreSnapshot }
|
||||||
) {
|
) {
|
||||||
const [current, setCurrent] = useState(() => createStore(opts))
|
const [current, setCurrent] = useState(() => createStore(opts))
|
||||||
|
|
||||||
|
|
|
@ -1584,7 +1584,7 @@ export interface TldrawImageProps extends TLSvgOptions {
|
||||||
licenseKey?: string;
|
licenseKey?: string;
|
||||||
pageId?: TLPageId;
|
pageId?: TLPageId;
|
||||||
shapeUtils?: readonly TLAnyShapeUtilConstructor[];
|
shapeUtils?: readonly TLAnyShapeUtilConstructor[];
|
||||||
snapshot: TLEditorSnapshot | TLStoreSnapshot;
|
snapshot: Partial<TLEditorSnapshot> | TLStoreSnapshot;
|
||||||
}
|
}
|
||||||
|
|
||||||
// @public (undocumented)
|
// @public (undocumented)
|
||||||
|
|
|
@ -24,7 +24,7 @@ export interface TldrawImageProps extends TLSvgOptions {
|
||||||
/**
|
/**
|
||||||
* The snapshot to display.
|
* The snapshot to display.
|
||||||
*/
|
*/
|
||||||
snapshot: TLEditorSnapshot | TLStoreSnapshot
|
snapshot: Partial<TLEditorSnapshot> | TLStoreSnapshot
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The image format to use. Defaults to 'svg'.
|
* The image format to use. Defaults to 'svg'.
|
||||||
|
|
Loading…
Reference in a new issue