skyra-project / discord-components

Discord Webcomponents for real looking messages on the web

Home Page:https://discord-components.js.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

bug: Updating the embed-title dynamically removes the embed-description

fictivecreations opened this issue · comments

Describe the bug

The embed-title when updated using vanilla js (.setAttribute), to an empty value, appears to remove the embed description from the dom.

To Reproduce
Working Repro here: https://codesandbox.io/s/discord-components-static-forked-x319d?file=/index.html

Given an input in the same ui as the example discord embed shown here:
https://codesandbox.io/s/discord-components-static-nhwkl

with an onKeyUp hooked up like this:

window.onEmbedChange = (evt) => {
  const embed = document.querySelector("discord-embed");
  embed.setAttribute('embed-title', evt.value);
};

It will update the title just fine, but if I backspace to a 'blank' value, the entirety of the embed-description ends up removed from the dom.

Expected behavior

The embed description should persist.

Additional context

I am using this unpkg version of the package:
https://unpkg.com/@skyra/discord-components-core

Well.. it's not going to be the best developer experience of a fix.. but this will need a breaking change to fix. Apparently Stencil updates the components for description and footer. Why? No idea. Their data doesn't change. But the fix is splitting those off to their own components, discord-embed-description and discord-embed-footer.

Fixed in bdec29c and published as v3.0.0 (unpkg will auto update). Please mind the breaking changes: https://github.com/skyra-project/discord-components/releases/tag/v3.0.0

Thank you so much for the quick fix!! Really appreciate it. 🎉