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

Error spam "$attrs is readonly" and "$listeners is readonly" with NcButton #5267

Closed
max-nextcloud opened this issue Feb 20, 2024 · 6 comments
Assignees

Comments

@max-nextcloud
Copy link
Contributor

max-nextcloud commented Feb 20, 2024

We have introduced a link popover recently in text. The component is loaded via a tiptap mechanism. It's triggering lot of errors in the console:

Bildschirmfoto vom 2024-02-19 09-20-04

Removing NcButton from the component makes the errors go away. So I suspect it's due to the attrs magic that NcButton applies.

See also:

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

So I suspect it's due to the attrs magic that NcButton applies.

It doesn't do anything specific, just passing attrs. There is no actual mutation of $attrs or $listeners in NcButton or other components.

This happens when parent component instance and child component instance are from different Vue when there are multiple Vue on the page. Vue fails to check that the instance is the parent.

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

*Checking some guesses

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

This happens when parent component instance and child component instance are from different Vue when there are multiple Vue on the page. Vue fails to check that the instance is the parent.

A bit more details. When a VNode with a component is rendered for the first time, component instance is created. During instance creation, $attrs and $readonly properties are defined on the instance:

https:/vuejs/vue/blob/main/src/core/instance/render.ts#L51-L85

Here it checks isUpdatingChildComponent. This flag is a global module-scope flag:

https:/vuejs/vue/blob/main/src/core/instance/lifecycle.ts#L25

isUpdatingChildComponent is true when during the rendering (patching) a component is updating a child components instance (its props etc.).

So, this error is shown when in a VDOM tree there are VNodes created by different Vue copies on the page and parent from one Vue updates child from another Vue.

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

image

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

So...

There is nothing we can do on the @nextcloud/vue side. When (absolutely any) component is rendered first in a tiptap plugin it is assigned to Text's Vue which makes this component "unusable" in Viewer (via Text's viewer component).

Because Viewer's components are used directly as a component in Viewer's rendering, Vue should be externalized from any Viewer's component, including Editor and tiptap plugins.

Something like https:/ueberdosis/tiptap/blob/main/packages/vue-2/src/VueNodeViewRenderer.ts#L67

The only problem — to get Vue from Viewer in LinkBubblePluginView

@ShGKme
Copy link
Contributor

ShGKme commented Feb 20, 2024

Closing, because there is no issue on @nextcloud/vue side. NcButton is only broken because it is the only component used in both editor and plugins in Text.

Fix: nextcloud/text#5402

@ShGKme ShGKme closed this as not planned Won't fix, can't repro, duplicate, stale Feb 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants