Skip to content

Commit

Permalink
fix(page): clipboard payload does not have assets (toeverything#6194)
Browse files Browse the repository at this point in the history
  • Loading branch information
fourdim authored Feb 5, 2024
1 parent 6b04654 commit 034894e
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export class AttachmentBlockTransformer extends BaseBlockTransformer<AttachmentB
): Promise<SnapshotReturn<AttachmentBlockProps>> {
const snapshotRet = await super.fromSnapshot(payload);
const sourceId = snapshotRet.props.sourceId;
if (sourceId) await payload.assets.writeToBlob(sourceId);
if (!payload.assets.isEmpty() && sourceId)
await payload.assets.writeToBlob(sourceId);

return snapshotRet;
}
Expand Down
2 changes: 1 addition & 1 deletion packages/blocks/src/image-block/image-transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ export class ImageBlockTransformer extends BaseBlockTransformer<ImageBlockProps>
): Promise<SnapshotReturn<ImageBlockProps>> {
const snapshotRet = await super.fromSnapshot(payload);
const sourceId = snapshotRet.props.sourceId;
if (sourceId && !sourceId.startsWith('/'))
if (!payload.assets.isEmpty() && sourceId && !sourceId.startsWith('/'))
await payload.assets.writeToBlob(sourceId);

return snapshotRet;
Expand Down
4 changes: 4 additions & 0 deletions packages/framework/store/src/transformer/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,10 @@ export class AssetsManager {
return this._assetsMap;
}

isEmpty() {
return this._assetsMap.size === 0;
}

cleanup() {
this._assetsMap.clear();
}
Expand Down

14 comments on commit 034894e

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB (-6.34 kB) 2.79 MB (-672 B) 1.74 MB (+69 B)

Packages

Name Size Gzip Brotli
blocks 2.1 MB (+473 B) 495 kB (-584 B) 363 kB (+533 B)
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

@github-actions
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size Report

Bundles

Entry Size Gzip Brotli
examples/basic 13.4 MB 2.79 MB 1.74 MB

Packages

Name Size Gzip Brotli
blocks 2.1 MB 495 kB 363 kB
editor 84 B 89 B 63 B
store 83 B 88 B 63 B
inline 84 B 88 B 63 B

Please sign in to comment.