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

[BUG] [DUPLICATE] Controlled drawer render twice drawer content #526

Open
DavidRojas1612 opened this issue Dec 11, 2024 · 1 comment
Open

Comments

@DavidRojas1612
Copy link

DavidRojas1612 commented Dec 11, 2024

Hi everybody, i had having a bug when i try to use a controlled drawer, its render twice the drawer content and idk why. any idea?

showContactInfo is a boolean on zustand.

      <Drawer
        open={showContactInfo}
        onOpenChange={(open) => {
          dispatch([{ type: StateTypes.showContactInfo, value: open }]);
        }}
        direction="bottom"
      >
        <DrawerContent className="max-h-[90dvh] min-h-[40dvh] w-full min-w-full block bg-white">
          <DrawerTitle className="sr-only" />
          <ContantPanel
            hasAlerts={hasAlerts}
            contactInfo={contactInfo}
            onClose={() =>
              dispatch([
                { type: StateTypes.showContactInfo, value: false },
                { type: StateTypes.backToContact, value: false },
              ])
            }
            onAlertsManagement={() => {
              dispatch([
                { type: StateTypes.showContactInfo, value: false },
                { type: StateTypes.showAlerts, value: true },
                { type: StateTypes.backToContact, value: true },
              ]);
            }}
          />
        </DrawerContent>
      </Drawer>

bug-twice

@DavidRojas1612
Copy link
Author

i found the bug is on onOpenChange, when i pass a setter from useState it works very well, so, does exist any way to use zustand with vaul ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant