cschroeter / park-ui

Beautifully designed components built on Ark UI that work for the JS and CSS frameworks of your choice.
https://park-ui.com
MIT License
1.47k stars 59 forks source link

Context Error: usePresenceContext return `undefined` when using the Menu component in Solid JS #359

Open jackvane opened 4 days ago

jackvane commented 4 days ago

I'm on Ark UI 3.4.1, Solid Start 1.0.2 and Solid 1.8.18. When using the Menu component like so:

function UserMenu() {
  const { user: u } = useAuthContext();

  const user = u();

  if (!user) {
    return null;
  }

  return (
    <Menu.Root>
      <Menu.Trigger class="rounded-full">
        <Avatar name={user.firstName + " " + user.lastName} />
      </Menu.Trigger>

      <Menu.Positioner>
        <Menu.Content>
          <Menu.Arrow>
            <Menu.ArrowTip />
          </Menu.Arrow>

          <Menu.Item value="react">React</Menu.Item>
          <Menu.Item value="solid">Solid</Menu.Item>
          <Menu.Item value="vue">Vue</Menu.Item>
        </Menu.Content>
      </Menu.Positioner>
    </Menu.Root>
  );
}

I received the following error:

Screenshot 2024-07-01 at 7 46 36

The component was pulled using the cli.

jackvane commented 4 days ago

Note this is also an issue for the Dialog component

Screenshot 2024-07-01 at 10 59 08
dannylin108 commented 3 days ago

It seems you forgot wrap it with Context or Provider component:

https://ark-ui.com/solid/docs/guides/component-state

Lenstack commented 2 days ago

I have the same problem using the cli components.

jackvane commented 1 day ago

Isn't the point of the library to be pull and play? I'm not forgetting to wrap anything, it should've already been wrapped.