vtex-apps / store-link

The Store Link app provides blocks for displaying links in other theme blocks
4 stars 5 forks source link

v0.8.2 has a breaking change #55

Closed pedrobernardina closed 1 year ago

pedrobernardina commented 1 year ago

This week we realized that none of our modal were working. After some debugging, we discovered that StoreLink was not working as a trigger anymore. I believe it's common to use StoreLink as a button in store-theme, and in our store it is used mostly as a modal trigger.

Investiganting this repo, I suspected that the problem was with v0.8.2. Manually installing v0.8.1 confirmed my suspicions, as everything started working again.

Checking the tags history, commit 9c5cbf60abf886b999711f4f18fd1f574669fb5b introduced the following change:

 const handlePrevent = (e: React.MouseEvent) =>{
    e.stopPropagation()
    e.nativeEvent.stopImmediatePropagation()
}

<div onClick={handlePrevent} className={handles.linkContainer}>
  <Link
        to={resolvedLink}
        target={target}
        className={rootClasses}
        scrollOptions={scrollOptions}
        rel={rel}
        onClick={handlePrevent}
      >
        {label && <span className={labelClasses}>{localizedLabel}</span>}
        {hasChildren(children) && (
          <div className={handles.childrenContainer}>{children}</div>
        )}
      </Link>
    </div>

In fact, this is a breaking change, as previous expected behaviour is not working as intended anymore.

I suggest:

  1. Adding a control prop to stop propagation or not; or
  2. Releasing a major version instead.

Tagging @jpesce for visibility.

filipewl commented 1 year ago

Thanks for the report @pedrobernardina!

We deployed version v0.9.2 with a rollback of the changes from v0.8.2.

Please let us know if you encountered any issues by re-opening this issue.