[wp-trac] [WordPress Trac] #65211: Font upload shows failure message but font is added to library
WordPress Trac
noreply at wordpress.org
Tue May 12 07:32:26 UTC 2026
#65211: Font upload shows failure message but font is added to library
-----------------------------+------------------------------
Reporter: 369work | Owner: (none)
Type: defect (bug) | Status: new
Priority: normal | Milestone: Awaiting Review
Component: General | Version: trunk
Severity: normal | Resolution:
Keywords: has-screenshots | Focuses: performance
-----------------------------+------------------------------
Comment (by 369work):
I want to clarify that this is not an environment-specific issue.
The browser console clearly shows:
Cannot read properties of undefined (reading 'styles')
This is a JavaScript error — meaning the code itself is crashing, not the
environment misbehaving.
The key condition to reproduce is "first upload ever, via Appearance >
Fonts, before any upload via the Editor".
Once a font has been uploaded via Appearance > Editor > Style > Typography
> Fonts, the error disappears — even in Edge.
This strongly suggests that the two upload paths initialize state
differently.
The Editor path hydrates some font family data into state first.
The Appearance > Fonts path does not — and when it tries to read .styles
from that uninitialized data, it throws.
Testers who cannot reproduce this may already have font upload history in
their environment, which means the state is already initialized before
testing.
Additionally, Edge and Chrome are both Chromium-based, so the difference
between them is unlikely to be a compatibility issue.
A more likely explanation is a timing difference in async/Promise
execution order:
Chrome: state is initialized before the upload response is processed →
.styles exists → no error
Edge: upload response is processed before state initialization completes →
.styles is undefined → crash
This is a classic race condition pattern — same engine, different
execution timing, undefined property.
The fix would be to guard against undefined before reading .styles, or
ensure state is initialized before processing the upload response,
regardless of execution order.
This is a reproducible code-path bug, not a browser or environment issue.
--
Ticket URL: <https://core.trac.wordpress.org/ticket/65211#comment:7>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform
More information about the wp-trac
mailing list