Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: NodePos.setAttribute doesn't re-render NodeView #5671

Closed
1 task done
rChaoz opened this issue Sep 26, 2024 · 2 comments · Fixed by #5716
Closed
1 task done

[Bug]: NodePos.setAttribute doesn't re-render NodeView #5671

rChaoz opened this issue Sep 26, 2024 · 2 comments · Fixed by #5716
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug

Comments

@rChaoz
Copy link

rChaoz commented Sep 26, 2024

Affected Packages

core

Version(s)

2.7.3

Bug Description

Using NodePos.setAttribute() to update the attributes of a node doesn't seem to re-render a NodeView (or the attributes aren't changed at all). Changing it for a custom transaction works.

This doesn't work:

editor.$node("image", { loadingId }).setAttribute(someAttributes)

This works:

editor.commands.command(({ tr, state }) => {
    let done = false
    state.doc.descendants((node, pos) => {
        if (node.type.name === "image" && node.attrs.loadingId === loadingId) {
            tr.setNodeMarkup(pos, undefined, someAttributes)
            done = true
        }
        return !done
    })
    return true
}),

Might be caused by #5672. I don't see any errors in the console tho, like index out of bounds (if I manually call tr.setNodeMarkup with NodePos.pos as the position it throws that error, as the image is the last node).

Browser Used

Firefox

Code Example URL

No response

Expected Behavior

Dependency Updates

  • Yes, I've updated all my dependencies.
@rChaoz rChaoz added Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug labels Sep 26, 2024
@Eshchock1
Copy link

+1

@nperez0111
Copy link
Contributor

This is released with v2.9.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Category: Open Source The issue or pull reuqest is related to the open source packages of Tiptap. Type: Bug The issue or pullrequest is related to a bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants