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

[DOCK]: The argument must be React element, but you passed null! #239

Open
alamenai opened this issue Jul 25, 2024 · 2 comments
Open

[DOCK]: The argument must be React element, but you passed null! #239

alamenai opened this issue Jul 25, 2024 · 2 comments

Comments

@alamenai
Copy link
Contributor

Hi,

I have Dock with 4 dock icons, the first 3 are usually visible however the fourth one is based on a condition:

 <Dock className='rounded-full border-none gap-5 backdrop-blur-3xl bg-black/50 p-2 animate-slide-up relative m-0'>
              <DockIcon
                className={cn(isDeletedAllRoofsEnaled && "bg-white")}
                onClick={() => {
                  enableDeletedAllRoofs(!isDeletedAllRoofsEnaled)
                  enablePanelSelection(false)
                  setIsResizeRoofMenuVisible(false)
                }}
              >
                <TooltipProvider delayDuration={100}>
                  <Tooltip>
                    <TooltipTrigger asChild>
                      <Diff
                        className={cn("relative rounded-full text-white", isDeletedAllRoofsEnaled && "text-black")}
                      />
                    </TooltipTrigger>
                    <TooltipContent>
                      <p>Dächer hinzufügen oder entfernen</p>
                    </TooltipContent>
                  </Tooltip>
                </TooltipProvider>
              </DockIcon>
              <DockIcon
                className={cn(isSelectedPanelEnabled && "bg-white")}
                onClick={() => {
                  enablePanelSelection(!isSelectedPanelEnabled)
                  enableDeletedAllRoofs(false)
                  setIsResizeRoofMenuVisible(false)
                }}
              >
                <TooltipProvider delayDuration={100}>
                  <Tooltip>
                    <TooltipTrigger asChild>
                      <MousePointerSquare
                        className={cn("relative rounded-full text-white", isSelectedPanelEnabled && "text-black")}
                      />
                    </TooltipTrigger>
                    <TooltipContent>
                      <p>Dächer hinzufügen oder entfernen</p>
                    </TooltipContent>
                  </Tooltip>
                </TooltipProvider>
              </DockIcon>
              <DockIcon
                className={cn(roofResizeMethod && "bg-white")}
                onClick={() => setIsResizeRoofMenuVisible(!isResizeRoofMenuVisible)}
              >
                <TooltipProvider delayDuration={100}>
                  <Tooltip>
                    <TooltipTrigger asChild>
                      <Scaling className={cn("relative rounded-full text-white", roofResizeMethod && "text-black")} />
                    </TooltipTrigger>
                    <TooltipContent>
                      <p>Dächer hinzufügen oder entfernen</p>
                    </TooltipContent>
                  </Tooltip>
                </TooltipProvider>
              </DockIcon>

              {newRoofs.length > 0 && (
                <DockIcon
                  className={cn(newRoofs.length > 0 && "bg-white")}
                  onClick={() => {
                    installPvSystem(roofs)
                    setNewRoofs([])
                  }}
                >
                  <TooltipProvider delayDuration={100}>
                    <Tooltip>
                      <TooltipTrigger asChild>
                        <UndoDot
                          className={cn("relative rounded-full text-white", newRoofs.length > 0 && "text-black")}
                        />
                      </TooltipTrigger>
                      <TooltipContent>
                        <p>Dächer hinzufügen oder entfernen</p>
                      </TooltipContent>
                    </Tooltip>
                  </TooltipProvider>
                </DockIcon>
              )}
            </Dock>

As you see in the last one, it will be visible only when newRoofs.length>0 but it seems that the Dock component access to null which throws this error:

image

image

@itsarghyadas
Copy link
Collaborator

Did you try any solution?

@alamenai
Copy link
Contributor Author

Hi @itsarghyadas , no I did not, I changed the component at all.

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

2 participants