Skip to content

fix(js): skip redux toggle when opening native block inserter#487

Open
jkmassel wants to merge 1 commit into
jkmassel/android-block-pickerfrom
jkmassel/native-inserter-no-redux-flash
Open

fix(js): skip redux toggle when opening native block inserter#487
jkmassel wants to merge 1 commit into
jkmassel/android-block-pickerfrom
jkmassel/native-inserter-no-redux-flash

Conversation

@jkmassel
Copy link
Copy Markdown
Contributor

@jkmassel jkmassel commented May 4, 2026

Summary

Tapping the + button currently calls setIsInserterOpened(true) on the editor store, which momentarily renders Gutenberg's web inserter UI before the native dialog covers it — a visible flash on slower devices. Call prepareAndShowInserter() directly instead; the redux flag isn't useful when the inserter is rendered natively.

Test plan

  • On Android (or iOS), with enableNativeBlockInserter on, tap the + toolbar button
  • Native inserter dialog appears immediately, no flash of the web inserter behind it
  • The dialog still closes correctly via the X button (still goes through onToggle(false) from window.blockInserter.onClose)

@github-actions github-actions Bot added the [Type] Bug An existing feature does not function as intended label May 4, 2026
@jkmassel jkmassel force-pushed the jkmassel/native-inserter-no-redux-flash branch 2 times, most recently from 857a294 to e84a41c Compare May 11, 2026 21:44
@jkmassel jkmassel requested a review from oguzkocer May 11, 2026 21:49
@wpmobilebot
Copy link
Copy Markdown

wpmobilebot commented May 12, 2026

XCFramework Build

This PR's XCFramework is available for testing. Add the following to your Package.swift:

.package(url: "https://github.com/wordpress-mobile/GutenbergKit", branch: "pr-build/487")

Built from 045288c

Tapping the `+` button currently calls `setIsInserterOpened(true)` in
the editor store, which momentarily renders Gutenberg's web inserter
before the native dialog covers it — visible as a flash on slower
devices. Call `prepareAndShowInserter()` directly instead; the redux
flag isn't useful when the inserter is rendered natively.
@jkmassel jkmassel force-pushed the jkmassel/native-inserter-no-redux-flash branch from e84a41c to 045288c Compare May 12, 2026 20:44
@jkmassel jkmassel changed the base branch from trunk to jkmassel/android-block-picker May 12, 2026 20:44
Copy link
Copy Markdown
Contributor

@oguzkocer oguzkocer left a comment

Choose a reason for hiding this comment

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

@jkmassel Do you have a recording of the flash this is fixing? Because I tried recording before and after and I don't see any change. I am working with Claude to see maybe it's just a build issue on my end because I tested the fix before I tested the base branch. Here are the recordings:

Recording from: jkmassel/android-block-picker:

487-before.webm

Recording from jkmassel/native-inserter-no-redux-flash:

487-after.webm

Copy link
Copy Markdown
Contributor

@oguzkocer oguzkocer left a comment

Choose a reason for hiding this comment

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

I think maybe the reason I am not seeing a flash is this:

a visible flash on slower devices.

So, I am going to approve the PR on the code change and the fact that I am not observing a flash after the change. 🤷

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

[Type] Bug An existing feature does not function as intended

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants