From 0020e54b7793f1b8feb51e2dd5253c9410c6199d Mon Sep 17 00:00:00 2001 From: Miguel Fonseca <150562+mcsf@users.noreply.github.com> Date: Mon, 17 Jul 2023 16:14:40 +0100 Subject: [PATCH] Add TODO note about RNMobile's circular dependencies --- .../src/footnotes/get-rich-text-values-cached.js | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/packages/core-data/src/footnotes/get-rich-text-values-cached.js b/packages/core-data/src/footnotes/get-rich-text-values-cached.js index 85308f4130f3ef..06a01c5ef63fdd 100644 --- a/packages/core-data/src/footnotes/get-rich-text-values-cached.js +++ b/packages/core-data/src/footnotes/get-rich-text-values-cached.js @@ -8,8 +8,16 @@ import { privateApis as blockEditorPrivateApis } from '@wordpress/block-editor'; */ import { unlock } from '../private-apis'; -// Avoid calling `unlock` at the module level, deferring the call until needed -// in `getRichTextValuesCached`. +// TODO: The following line should have been: +// +// const unlockedApis = unlock( blockEditorPrivateApis ); +// +// But there are hidden circular dependencies in RNMobile code, specifically in +// certain native components in the `components` package that depend on +// `block-editor`. What follows is a workaround that defers the `unlock` call +// to prevent native code from failing. +// +// Fix once https://github.com/WordPress/gutenberg/issues/52692 is closed. let unlockedApis; const cache = new WeakMap();