@@ -21,7 +21,6 @@ import { type Post } from '../entity-types/post';
2121import { type Type } from '../entity-types' ;
2222import { CRDT_RECORD_MAP_KEY } from '../sync' ;
2323import type { WPBlockSelection , WPSelection } from '../types' ;
24- import { shouldSyncMetaForPostType } from './crdt-meta' ;
2524
2625export type PostChanges = Partial < Post > & {
2726 blocks ?: Block [ ] ;
@@ -52,6 +51,9 @@ const allowedPostProperties = new Set< string >( [
5251 'title' ,
5352] ) ;
5453
54+ // Post meta keys that should *not* be synced.
55+ const disallowedPostMetaKeys = new Set < string > ( [ ] ) ;
56+
5557/**
5658 * Given a set of local changes to a generic entity record, apply those changes
5759 * to the local Y.Doc.
@@ -94,13 +96,13 @@ export function defaultApplyChangesToCRDTDoc(
9496 *
9597 * @param {CRDTDoc } ydoc
9698 * @param {PostChanges } changes
97- * @param {Type } postType
99+ * @param {Type } _postType
98100 * @return {void }
99101 */
100102export function applyPostChangesToCRDTDoc (
101103 ydoc : CRDTDoc ,
102104 changes : PostChanges ,
103- postType : Type
105+ _postType : Type // eslint-disable-line @typescript-eslint/no-unused-vars
104106) : void {
105107 const ymap = ydoc . getMap ( CRDT_RECORD_MAP_KEY ) ;
106108
@@ -162,9 +164,7 @@ export function applyPostChangesToCRDTDoc(
162164 // should be synced.
163165 Object . entries ( newValue ?? { } ) . forEach (
164166 ( [ metaKey , metaValue ] ) => {
165- if (
166- ! shouldSyncMetaForPostType ( metaKey , postType )
167- ) {
167+ if ( disallowedPostMetaKeys . has ( metaKey ) ) {
168168 return ;
169169 }
170170
@@ -232,13 +232,13 @@ export function defaultGetChangesFromCRDTDoc( crdtDoc: CRDTDoc ): ObjectData {
232232 *
233233 * @param {CRDTDoc } ydoc
234234 * @param {Post } editedRecord
235- * @param {Type } postType
235+ * @param {Type } _postType
236236 * @return {Partial<PostChanges> } The changes that should be applied to the local record.
237237 */
238238export function getPostChangesFromCRDTDoc (
239239 ydoc : CRDTDoc ,
240240 editedRecord : Post ,
241- postType : Type
241+ _postType : Type // eslint-disable-line @typescript-eslint/no-unused-vars
242242) : PostChanges {
243243 const ymap = ydoc . getMap ( CRDT_RECORD_MAP_KEY ) ;
244244
@@ -280,7 +280,7 @@ export function getPostChangesFromCRDTDoc(
280280 allowedMetaChanges = Object . fromEntries (
281281 Object . entries ( newValue ?? { } ) . filter (
282282 ( [ metaKey ] ) =>
283- shouldSyncMetaForPostType ( metaKey , postType )
283+ ! disallowedPostMetaKeys . has ( metaKey )
284284 )
285285 ) ;
286286
0 commit comments