Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
816e55c
Being adding user info
ingeniumed Jan 15, 2026
f81ed74
Got the user fetch working
ingeniumed Jan 16, 2026
6e3eb80
Added in some test logging
ingeniumed Jan 16, 2026
2836b7e
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/user-…
ingeniumed Jan 16, 2026
cf05627
Attempting to fix the sync
ingeniumed Jan 16, 2026
2c1d5cf
Add a comment explining the bug
ingeniumed Jan 18, 2026
8772cb2
Add support for selection
ingeniumed Jan 19, 2026
979e04a
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/user-…
ingeniumed Jan 19, 2026
e68cfde
Ensure the pckakge-lock changes are in
ingeniumed Jan 19, 2026
77cad8f
Add more comments and simplify the user handling
ingeniumed Jan 19, 2026
0e12107
Tweak the exported functions
ingeniumed Jan 19, 2026
1b19ef1
Revert the webpack workaround
ingeniumed Jan 19, 2026
215942c
Fix the type error
ingeniumed Jan 19, 2026
4f37149
ignore types for block editor import
ingeniumed Jan 19, 2026
e9cc4bc
Fix the typo in the constant
ingeniumed Jan 19, 2026
63a11d7
Tweaked the local storage key
ingeniumed Jan 19, 2026
71c7741
Attempting to solve the test failures
ingeniumed Jan 20, 2026
f6a7cc0
Fix the test fialures
ingeniumed Jan 20, 2026
45c439d
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/user-…
ingeniumed Jan 20, 2026
9200272
Remove a TODO
ingeniumed Jan 20, 2026
a2f7a09
Re-wrote the user selection to be in the core-data, and move the awar…
ingeniumed Jan 21, 2026
d1066e9
Clean up the code
ingeniumed Jan 21, 2026
96c6e6a
Added a todo for local storage
ingeniumed Jan 21, 2026
40bba56
Remove the block-editor fix
ingeniumed Jan 21, 2026
9fb1542
Fix the test using STORE_NAME
ingeniumed Jan 21, 2026
266fd2c
Move awareness implementation details to core-data, and only leave th…
ingeniumed Jan 22, 2026
2d6ca82
Replace undefined awareness test with a mock
ingeniumed Jan 22, 2026
335f32f
Fix the tests failures in resolvers
ingeniumed Jan 22, 2026
4e6bff0
Merge branch 'trunk' of github.com:WordPress/gutenberg into add/user-…
ingeniumed Jan 22, 2026
731eea5
Improve types and keep WordPress domain knowledge out of sync package…
chriszarate Jan 22, 2026
e8af246
Remove unnecessary exports
chriszarate Jan 22, 2026
daa079a
Rename getAwarenessInstance => getAwareness for symmetry
chriszarate Jan 22, 2026
fa964ed
Remove vestial userInfo reference
chriszarate Jan 22, 2026
ec820f4
Relocate selection types and use YMapWrap
chriszarate Jan 22, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions packages/core-data/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@
"uuid": "^9.0.1"
},
"devDependencies": {
"@types/node": "^20.17.10",

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Noticed that the NodeJs.timeout was giving me errors and realized this wasn't there.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It's better to use the same version of this package (@types/node) as used in other places in the monorepo. I have fixed it in #74950

"deep-freeze": "0.0.1"
},
"peerDependencies": {
Expand Down
21 changes: 20 additions & 1 deletion packages/core-data/src/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
isNumericID,
} from './utils';
import { fetchBlockPatterns } from './fetch';
import { subscribeToUserSelectionChanges } from './utils/crdt-user-selections';

/**
* Requests authors from the REST API.
Expand Down Expand Up @@ -192,7 +193,7 @@ export const getEntityRecord =
recordWithTransients,
{
// Handle edits sourced from the sync manager.
editRecord: ( edits ) => {
editRecord: ( edits, options = {} ) => {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is to allow for core-data and editor to not be used within selection-utils.ts from the sync package. It also means that the awareness instance is always aware about what post type and post ID it's meant for. There's no need to fetch it and verify if its set or not.

if ( ! Object.keys( edits ).length ) {
return;
}
Expand All @@ -206,6 +207,7 @@ export const getEntityRecord =
meta: {
undo: undefined,
},
options,
} );
},
// Get the current entity record (with edits)
Expand All @@ -232,6 +234,23 @@ export const getEntityRecord =
key
);
},
// Get the current user.
getCurrentUser: async () => {
await resolveSelect.getCurrentUser();
},
// Subscribe to user selection changes.
subscribeToUserSelectionChanges: (

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

This is the new way that selection changes are subscribed to. It takes in a setter, so that the throttledLocalStateField function can be passed in via Awareness. It can also allow for anything else to use this as well, should we want that.

yDoc,
setSelectionState
) => {
subscribeToUserSelectionChanges(
kind,
name,
key,
yDoc,
setSelectionState
);
},
}
);
}
Expand Down
4 changes: 4 additions & 0 deletions packages/core-data/src/test/resolvers.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,8 @@ describe( 'getEntityRecord', () => {
getEditedRecord: expect.any( Function ),
refetchRecord: expect.any( Function ),
saveRecord: expect.any( Function ),
getCurrentUser: expect.any( Function ),
subscribeToUserSelectionChanges: expect.any( Function ),
}
);
} );
Expand Down Expand Up @@ -225,6 +227,8 @@ describe( 'getEntityRecord', () => {
getEditedRecord: expect.any( Function ),
refetchRecord: expect.any( Function ),
saveRecord: expect.any( Function ),
getCurrentUser: expect.any( Function ),
subscribeToUserSelectionChanges: expect.any( Function ),
}
);
} );
Expand Down
Loading
Loading