Hi, I have a facetapi block with delta
-o81ct7rwJBOlUOYehFwEewaFOf2qC6K
As you can see, it starts with a "-". This somehow causes issues with modules like Collapsiblock (settings aren't saved) and other JS-related stuff.

The reason is that the full block id becomes
block-facetapi-o81ct7rwjboluoyehfweewafof2qc6k
instead of with double dashes:
block-facetapi--o81ct7rwjboluoyehfweewafof2qc6k

This means people have to write custom JS exceptions for block delta's starting with a "-".

Maybe we need to improve on the block delta generation. Views delta's never use _, - or mixed case. So I suggest using View's "delta encoding" to avoid unexpected JS issues and whatnot.

I know it's a minor detail,... I'll see if I can create a patch myself.

CommentFileSizeAuthor
#5 facetapi-1355270-5.patch1.33 KBcpliakas

Comments

Anonymous’s picture

For reference: issue-free generic views block delta can look like:
eff5d581d5762980bb823a63076dd0c7

Problematic FacetAPI delta:
-zDjVn3LYSmImZiqxy8UNBHRY_FiuTe-

Suggestions for improvement
- no mixed case
- only a-z, 0-9

Anonymous’s picture

I just renamed my entity property to get it a new delta, "DMKi4a8wNF5O4YGf4Sjy8rnF4G-97Hx-".
No issues with this one. Apparently, delta's really can't start with "-".

cpliakas’s picture

Priority: Minor » Normal

Great information. Thanks for reporting. I would definitely be in favor of an a-z0-9 hash. This will require a change to the hashing algorithm as well as an update function to regenerate hashes.

Thanks for the discovery,
Chris

cpliakas’s picture

Component: Code (functionality) » User interface (functionality)

Switching to UI, since this mostly effects jQuery.

cpliakas’s picture

Status: Active » Needs review
StatusFileSize
new1.33 KB

Try this patch out. Run update.php after applying and see if a) the blocks still show up and b) they have alpha-numeric hashes.

Anonymous’s picture

Component: User interface (functionality) » Code
Status: Needs review » Reviewed & tested by the community

Ok, tried this. After running the Update.php succesfully, it all worked.

Just needed to re-configure Block Theme and Context UI blocks, but that's a necessary evil. Can just make a "release note" of that.
In the end, all my problems with the ID's are solved.

Anonymous’s picture

Component: Code » User interface

back to UI

cpliakas’s picture

morningtime,

Thanks for testing! I think the upgrade path for the core Block mode works, so for a beta that is all we can hope for. If you want to work on adding support for Context UI and Block Theme I would definitely welcome that, however release notes might be good enough in these instances.

Thanks again,
Chris

cpliakas’s picture

Status: Reviewed & tested by the community » Fixed

Resolved in commit 9133a63.

cpliakas’s picture

Title: Rare case of block delta starting with a "-" leads to JS issues » Deltas starting with non alpha-numeric characters cause JavaScript issues

Status: Fixed » Closed (fixed)

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