After favouriting a page (and refreshing the page), the added page is not displayed in the "My Favourites" block.

This happens because the javascript and the html differ in the name of the data-block-plugin-id property of the block element.

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

john cook created an issue. See original summary.

john cook’s picture

Status: Active » Needs review

I've created a MR that brings the data-block-plugin-id value in the javascript inline with the HTML.

joseph.olstad’s picture

Hmm, strange I didn't notice this bug, thanks for the merge request!

joseph.olstad’s picture

StatusFileSize
new22.26 KB

Hmm, which block is this?

heart block

joseph.olstad’s picture

@john cook

what version of Drupal are you testing this against? My test build for this is using Drupal 10.4.x

Was this somehow changed in a newer Drupal? omg scream!

joseph.olstad’s picture

what theme are you using? Might be theme related

joseph.olstad’s picture

At the top of src/Plugin/Block/SimpleFavsBlock.php

it clearly states this:

/**
 * Provides a "My favourites" block for Simple Favs.
 *
 * @Block(
 *   id = "simple_favs_block",
 *   admin_label = @Translation("Simple Favs"),
 * )
 */

joseph.olstad’s picture

StatusFileSize
new9.49 KB

See screenshot

screenshot

joseph.olstad’s picture

Status: Needs review » Postponed (maintainer needs more info)

I'm not understanding this request. The SimpleFavsBlock.php class clearly states that the id is simple_favs_block.

john cook’s picture

StatusFileSize
new20.27 KB

We are using a custom theme for the site, so I switched to Olivero to test.

The data-block-plugin-id value is still in kebab case.
data-block-plugin-id="simple-favs-block"

I'm using Drupal 10.5.6, Simple favourites 2.0.10.

It may be worth checking for both values in the code:

once('simple-favs-render', '[data-block-plugin-id="simple_favs_block"], [data-block-plugin-id="simple-favs-block"]', context).forEach(function (block) {
joseph.olstad’s picture

Assigned: Unassigned » joseph.olstad
Status: Postponed (maintainer needs more info) » Active

Ok ya we can support both, checking now

joseph.olstad’s picture

  • joseph.olstad committed 25ac10d7 on 2.0.x
    fix: #3561864 My Favourites block not showing pages  By: john cook By:...
joseph.olstad’s picture

Assigned: joseph.olstad » Unassigned
Status: Active » Fixed

Thanks for working with me on this fix. It should be fixed in 2.0.11.

Please confirm if this fixes your issue, which I suspect it does.

https://www.drupal.org/project/simple_favs/releases/2.0.11

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.