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

ContextMenu: Cache duplication "focusedItemId" #5054

Closed
kaithar opened this issue Jan 9, 2024 · 1 comment
Closed

ContextMenu: Cache duplication "focusedItemId" #5054

kaithar opened this issue Jan 9, 2024 · 1 comment
Assignees
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Milestone

Comments

@kaithar
Copy link

kaithar commented Jan 9, 2024

Describe the bug

I'm not quite sure what is going on, and after digging I can't figure out if it's my fault or not. The warn trace I'm getting is this:

[Vue warn]: Computed property "focusedItemId" is already defined in Props. 
  at <ContextMenuSub ref=fn<bound listRef> id="pv_id_1_list" class="p-contextmenu-root-list"  ... > 
  at <BaseTransition onEnter=fn onAfterEnter=fn<bound onAfterEnter> onLeave=fn<onLeave>  ... > 
  at <Transition name="p-contextmenu" onEnter=fn<bound onEnter2> onAfterEnter=fn<bound onAfterEnter>  ... > 
  at <Portal appendTo="body" > 
  at <ContextMenu ref="conmenu" model= [{…}] > 

Digging through the function stack tells me it's being emitted from Vue's applyOptions trying to patch computed options while mounting... no idea what's failing though. It only emit this the second and subsequent times a context menu is accessed, so I assume it's failing to reapply some patching or failing to properly remove something?

I'm currently trying to use the component like this:

  <ContextMenu ref="conmenu" :model="conmenuops">
    <template #item="{ item, props }">
      <a :href="item.href" class="">{{ item.label }}</a>
    </template>
  </ContextMenu>
  <tr v-for="(a, i) in somedata" @contextmenu="reacter($event, [{ label: 'Sync', href: '/api/ext/' + a + '/sync' }])">
  </tr>
export default {
  data() {
    return { conmenuops: [] };
  },
  methods: {
    reacter(e, d) {
      this.conmenuops = ref(d);
      return this.$refs.conmenu.show(e); 
    },
}

I found some bugs remarking that the model needs to be a ref or reactive rather than just giving it a raw array, but I've tried all three and a couple of combinations. On the other hand, I'm not able to reproduce it outside of my code, so it's probably interacting with something else but I can't figure out what since I haven't seen this error prior to using primevue and I don't know what could be related to it.

Even if this isn't enough to figure out what the problem is, I'll take suggestions on where to look for what I'm doing wrong.

Reproducer

See report

PrimeVue version

3.46.0

Vue version

3.x

Language

TypeScript

Build / Runtime

Vite

Browser(s)

No response

Steps to reproduce the behavior

No response

Expected behavior

No response

@kaithar kaithar added the Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible label Jan 9, 2024
@mertsincan
Copy link
Member

Ops! Good catch, thanks a lot for your report! We'll fix it for the next version.

Best Regards,

@mertsincan mertsincan added Type: Bug Issue contains a bug related to a specific component. Something about the component is not working and removed Status: Needs Triage Issue will be reviewed by Core Team and a relevant label will be added as soon as possible labels Jan 11, 2024
@mertsincan mertsincan added this to the 3.47.0 milestone Jan 11, 2024
@mertsincan mertsincan self-assigned this Jan 15, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Issue contains a bug related to a specific component. Something about the component is not working
Projects
None yet
Development

No branches or pull requests

2 participants