nextcloud-vue icon indicating copy to clipboard operation
nextcloud-vue copied to clipboard

Filter out invalid Components

Open skjnldsv opened this issue 4 years ago • 6 comments

Problem

  • To prevent developers from adding components that does NOT fit Nextcloud standards, we prevent some to be rendered if they are not official ones.
  • It create issues when we want to wrap said component:
    <Actions>
      <ActionInput />  <!-- rendered -->
      <ActionButton /> <!-- rendered -->
      <Wrapper>
      	<ActionButton /> <!-- NOT rendered -->
      </Wrapper>
    </Actions>
    
    Even if the Wrapper is just rendering a valid Action.

Temp solution

  • We removed this in https://github.com/nextcloud/nextcloud-vue/pull/2252

Questions

  • But it still bring back the debate whether enforcing is really such a wanted feature
  • And if so, what approach should we take. Any component could theoretically set itself with a valid name and be rendered too :shrug:

Proposals:

  • We stop doing this and we just check if devs do bad things with it
  • We use css to hide the bad entries. Since we scope, we have a unique SCOPE ID that matches the library's build time. Since wrapping such components will still display them properly in the dom: image then we could hide all of those that does NOT match the library scope, or something like that :thinking:

I don't have strong preferences anymore. We don't have time reviewing every component created by devs, so :shrug:

skjnldsv avatar Sep 16 '21 10:09 skjnldsv

We stop doing this and we just check if devs do bad things with it

I would go with this one. Hiding stuff seems a bit hacky :grin:. People can do crazy things everywhere, why not inside <Actions>? :wink:

julien-nc avatar Sep 16 '21 10:09 julien-nc

People can do crazy things everywhere, why not inside <Actions>?

Well, Actions is not the only thing we protected :wink:

skjnldsv avatar Sep 16 '21 13:09 skjnldsv

We stop doing this and we just check if devs do bad things with it

Would vote for this as well especially since runtime component validation unecessarily uses CPU resources when we can check instead on build and/or CI :)

Pytal avatar Sep 16 '21 14:09 Pytal

I would also tend to not enforce this anymore. It will reduce CPU time and should simply work faster. As a dev you can do all kinds of unforseen stuff with the components, or simply not use them. We would hardly ever be able to prevent all undesired uses.

Although I have to admit that I wonder why you need a wrapper around your Actions, and whether this is a valid usage 😄🙈

raimund-schluessler avatar Sep 16 '21 18:09 raimund-schluessler

I would second the removal of this check #1962

Edit: Already done????? #2252

dartcafe avatar Sep 16 '21 21:09 dartcafe

@dartcafe yes, it created issues somewhere else

skjnldsv avatar Oct 19 '21 09:10 skjnldsv