nextcloud-libraries / nextcloud-libraries/nextcloud-vue

[NcActions] doesn't support non-direct NcAction* usage

Open
#5,171 21 comments 1 reaction 1 assignee View on GitHub

@ShGKme is already working on this.

Since Jan 29, 2024.

1. to develop feature: actions
Dominant language
Vue
Stars
246
Forks
99
Avg merge
1d 20h
Merged PRs (30d)
103

Description

This works:

<NcActions>
  <NcAction* />
  <NcAction* />
</NcActions>

This doesn't:

<NcActions>
  <MyActionWrapper* /> -- Renders <NcAction* />
  <MyActionWrapper* />
</NcActions>

The problem is that in NcActions we manually take actions from slot in render function.
And some parts check, what exactly action do we have.

For example, here (1)
https://github.com/nextcloud-libraries/nextcloud-vue/blob/0b1bf869a7ebed41ba1874d9009f32a66cc07dd4/src/components/NcActions/NcActions.vue#L1058-L1060

and here (2)

https://github.com/nextcloud-libraries/nextcloud-vue/blob/0b1bf869a7ebed41ba1874d9009f32a66cc07dd4/src/components/NcActions/NcActions.vue#L1321-L1327

Because as an action name we take vnode's component instance's name:
https://github.com/nextcloud-libraries/nextcloud-vue/blob/0b1bf869a7ebed41ba1874d9009f32a66cc07dd4/src/components/NcActions/NcActions.vue#L1047-L1049

For MyActionWrapper it will be MyActionWrapper even if it renders <NcActionButton>.

While (1) only results in broken inline feature, (2) now breaks a whole <NcActions> when we use custom wrappers.

The complex part here is that in Vue when a parent is being rendered, it has no child yet. So we cannot just make recursive getActionName. So during NcActions rendering we have no idea what child MyActionWrapper way actually be.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.