Skip to content

Remove cache around changing link#21948

Merged
pls78 merged 1 commit intotrunkfrom
21926-bug-with-links-added-to-the-gutenberg-native-table-block
Jan 7, 2025
Merged

Remove cache around changing link#21948
pls78 merged 1 commit intotrunkfrom
21926-bug-with-links-added-to-the-gutenberg-native-table-block

Conversation

@igorschoester
Copy link
Copy Markdown
Contributor

@igorschoester igorschoester commented Jan 7, 2025

Context

Summary

This PR can be summarized in the following changelog entry:

  • Fixes a bug where editing a link in the block editor would have unexpected consequences when using undo.

Relevant technical choices:

The cache via useCallback is too greedy.
Everything is re-created already (no useCallback around all other functions). Therefore, opting to remove the cache (useCallback) here for an easy fix.

Test instructions

Test instructions for the acceptance test before the PR gets merged

This PR can be acceptance tested by following these steps:

Setup

  • Edit a post in the block editor
  • Add the native gutenberg table block: 2×2 table ( the default size )
  • Add some text
  • Change the text in the 2nd column to be a link
    image

Test

In order for focus reasons:

  • Change the link in the 2nd column
  • Remove the text in the 1st column
  • With the keyboard click on CTRL + Z or Command + Z to undo the added text
  • The focus should shift back to the link
  • Edit the link again
  • Verify the text in the 1st column is back as before and not the link as before this fix

Relevant test scenarios

  • Changes should be tested with the browser console open
  • Changes should be tested on different posts/pages/taxonomies/custom post types/custom taxonomies
  • Changes should be tested on different editors (Default Block/Gutenberg/Classic/Elementor/other)
  • Changes should be tested on different browsers
  • Changes should be tested on multisite

Test instructions for QA when the code is in the RC

  • QA should use the same steps as above.

QA can test this PR by following these steps:

Impact check

This PR affects the following parts of the plugin, which may require extra testing:

  • The link control

UI changes

  • This PR changes the UI in the plugin. I have added the 'UI change' label to this PR.

Other environments

  • This PR also affects Shopify. I have added a changelog entry starting with [shopify-seo], added test instructions for Shopify and attached the Shopify label to this PR.

Documentation

  • I have written documentation for this change. For example, comments in the Relevant technical choices, comments in the code, documentation on Confluence / shared Google Drive / Yoast developer portal, or other.

Quality assurance

  • I have tested this code to the best of my abilities.
  • During testing, I had activated all plugins that Yoast SEO provides integrations for.
  • I have added unit tests to verify the code works as intended.
  • If any part of the code is behind a feature flag, my test instructions also cover cases where the feature flag is switched off.
  • I have written this PR in accordance with my team's definition of done.
  • I have checked that the base branch is correctly set.

Innovation

  • No innovation project is applicable for this PR.
  • This PR falls under an innovation project. I have attached the innovation label.
  • I have added my hours to the WBSO document.

Fixes #21926

The cache via useCallback is too greedy.
Everything is re-created already (no useCallback around all other functions).
Therefore, opting to remove the cache (useCallback) here for an easy fix.
@igorschoester igorschoester added the changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog label Jan 7, 2025
@coveralls
Copy link
Copy Markdown

Pull Request Test Coverage Report for Build edce163d38a81afee035deecf214df42fd06042f

Details

  • 0 of 1 (0.0%) changed or added relevant line in 1 file are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage remained the same at 54.617%

Changes Missing Coverage Covered Lines Changed/Added Lines %
packages/js/src/inline-links/inline.js 0 1 0.0%
Totals Coverage Status
Change from base Build 45dd38a55fdbf2d19d226c4f238cff37c474dd30: 0.0%
Covered Lines: 30084
Relevant Lines: 55453

💛 - Coveralls

@pls78 pls78 added this to the 24.4 milestone Jan 7, 2025
Copy link
Copy Markdown
Member

@pls78 pls78 left a comment

Choose a reason for hiding this comment

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

CR && Acc: ✅

@pls78 pls78 merged commit ae2273b into trunk Jan 7, 2025
@pls78 pls78 deleted the 21926-bug-with-links-added-to-the-gutenberg-native-table-block branch January 7, 2025 16:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog: bugfix Needs to be included in the 'Bugfixes' category in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug with links added to the Gutenberg native Table block

3 participants