mirror of
https://github.com/toeverything/AFFiNE.git
synced 2026-02-12 12:28:42 +00:00
fix(server): limit rootDoc snapshot size (#12625)
close CLOUD-225 <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit - **New Features** - Added support for reading document blocks without requiring a workspace or root document snapshot. - **Bug Fixes** - Improved handling of large workspace snapshots by skipping them when they exceed 10MB. - **Tests** - Introduced new test cases to cover scenarios where root or workspace snapshots are absent. - Expanded snapshot tests for document block reading. - **Refactor** - Updated several function signatures to make root and workspace snapshot parameters optional for greater flexibility. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -35,6 +35,18 @@ test('should read doc blocks work', async () => {
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should read doc blocks work without root doc', async () => {
|
||||
const doc = new YDoc({
|
||||
guid: 'test-doc',
|
||||
});
|
||||
applyUpdate(doc, docSnapshot);
|
||||
const result = await readAllBlocksFromDoc({
|
||||
ydoc: doc,
|
||||
spaceId: 'test-space',
|
||||
});
|
||||
expect(result).toMatchSnapshot();
|
||||
});
|
||||
|
||||
test('should get all docs from root doc work', async () => {
|
||||
const rootDoc = new YDoc({
|
||||
guid: 'test-root-doc',
|
||||
|
||||
Reference in New Issue
Block a user