cschroeter / park-ui

Beautifully designed components built with Ark UI and Panda CSS that work with a variety of JS frameworks.
https://park-ui.com
MIT License
1.75k stars 75 forks source link

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

Closed jackvane closed 4 months ago

jackvane commented 5 months 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 5 months ago

Note this is also an issue for the Dialog component

Screenshot 2024-07-01 at 10 59 08
dannylin108 commented 5 months ago

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

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

Lenstack commented 4 months ago

I have the same problem using the cli components.

jackvane commented 4 months 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.

cschroeter commented 4 months ago

@Lenstack

This should be resolved by now.

https://github.com/cschroeter/park-ui/assets/1846056/39593f66-ee4a-47bd-847c-4e89f1471b64

cschroeter commented 4 months ago

Please check https://github.com/cschroeter/park-ui/tree/main/components/solid/src/components/ui for reference