Payload Adsign Plugin

Lexical References

Track block relationships and backfill lexicalReferences

Lexical references store relationship/upload IDs used inside Lexical blocks as tags in a hidden field (default: lexicalReferences). This enables reverse lookups during revalidation without scanning all documents.

Enable or disable

Lexical references are enabled by default. You can disable globally or per collection:

payload.config.ts
import { adsignPlugin } from '@adsign/payload-adsign-plugin';

adsignPlugin({
  siteName: 'My Site',
  domain: 'example.com',
  lexicalReferences: {
    enabled: true,
    collections: {
      pages: true,
      articles: false,
    },
  },
});

Backfill existing documents

To populate lexicalReferences for existing documents, use the migration helper:

src/migrations/20250120_174643_lexical_references.ts
import type { MigrateUpArgs } from '@payloadcms/db-mongodb';
import { migrateLexicalReferences } from '@adsign/payload-adsign-plugin';

export async function up({ payload, req }: MigrateUpArgs): Promise<void> {
  await migrateLexicalReferences({
    payload,
    req,
    batchSize: 200,
    // collections: ['pages', 'articles'],
    // fieldName: 'lexicalReferences',
    // dryRun: true,
  });
}

Notes:

  • The migrator only touches collections that already have the lexicalReferences field and at least one richText field.
  • The update is skipped if tags are unchanged.

On this page