Codeinwp / otter-blocks

Create beautiful and attracting posts, pages, and landing pages with Gutenberg Blocks and Template Library by Otter.
https://wordpress.org/plugins/otter-blocks/
GNU General Public License v3.0
129 stars 33 forks source link

Fix pattern upsell show condtion #2194

Closed Soare-Robert-Daniel closed 2 months ago

Soare-Robert-Daniel commented 2 months ago

Closes #2193

Summary

Each pattern has an Upsell Notice embedded. If there are multiple notices, they are removed except the first one.

The condition that checked if the block is rendered inside the editor was using document.querySelected and evaluated before the rendering, thus making it to be always false.

By moving the check inside the effect, we fix this problem since the hook runs after the component is rendered on the page.

Screenshots


https://github.com/Codeinwp/otter-blocks/assets/17597852/3c7de8dd-1ad9-4f78-9f38-f4b89162a7c2

Test instructions

  1. Use Otter Free
  2. Insert many patterns
  3. You should see only one Upsell Notice block like in the video

Checklist before the final review

pirate-bot commented 2 months ago

Bundle Size Diff

Package Old Size New Size Diff
Animations 239.1 KB 239.1 KB 0 B (0.00%)
Blocks 1.5 MB 1.5 MB 7 B (0.00%)
CSS 93.17 KB 93.17 KB 0 B (0.00%)
Dashboard 201.53 KB 201.53 KB 0 B (0.00%)
Onboarding 154.18 KB 154.18 KB 0 B (0.00%)
Export Import 90.95 KB 90.95 KB 0 B (0.00%)
Pro 355.91 KB 355.91 KB 0 B (0.00%)
pirate-bot commented 2 months ago

Plugin build for 76110fb243719a81624e9f45dc51fd9bbe1a0a61 is ready :bellhop_bell:!

pirate-bot commented 2 months ago

E2E Tests

Playwright Test Status:

Performance Results serverResponse: 211.3, firstPaint: 545.1, domContentLoaded: 1529.55, loaded: 1530.25, firstContentfulPaint: 3512.1, firstBlock: 5246.25, type: 11.19, minType: 9.56, maxType: 13.16, typeContainer: 7.77, minTypeContainer: 6.94, maxTypeContainer: 8.75, focus: 39.31, minFocus: 32.94, maxFocus: 48.08, inserterOpen: 29.46, minInserterOpen: 25.75, maxInserterOpen: 37.28, inserterSearch: 6.68, minInserterSearch: 6.13, maxInserterSearch: 7.38, inserterHover: 3.23, minInserterHover: 2.76, maxInserterHover: 5.27, listViewOpen: 150.04, minListViewOpen: 134.22, maxListViewOpen: 184.25
pirate-bot commented 2 months ago

:tada: This PR is included in version 2.6.11 :tada:

The release is available on GitHub release

Your semantic-release bot :package::rocket: