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

Option ifOverflow='extendDomain' not working anymore for ReferenceLine and ReferenceArea #3438

Closed
1 task done
lukask-proxora opened this issue Mar 5, 2023 · 12 comments
Closed
1 task done
Assignees
Labels
bug General bug label

Comments

@lukask-proxora
Copy link
Contributor

lukask-proxora commented Mar 5, 2023

  • I have searched the issues of this repository and believe that this is not a duplicate.

Reproduction link

Edit on CodeSandbox

Steps to reproduce

Add a ReferenceLine or ReferenceArea that falls outside of the legend domains and set the prop ifOverflow to 'extendDomain'.

What is expected?

The domains are extended to fit the reference object.

What is actually happening?

The reference object is drawn, but the domains are not extended. This basically behaves as the option 'visible'.

Environment Info
Recharts v2.4.3
React 18.2.0
System Ubuntu 22.04.2 LTS
Browser Chromium 108.0.5359.124

This only happens since version 2.4.0
By changing the version in the code sandbox you can easily verify that it works correctly for version 3.3.2

@ckifer
Copy link
Member

ckifer commented Mar 6, 2023

Aren't these the same?

#3379

@ckifer ckifer added the bug General bug label label Mar 6, 2023
@lukask-proxora
Copy link
Contributor Author

@ckifer #3379 also occurs in earlier versions, so they are different bugs.

I had a quick look into the code and found out that the problem here is that the yAxisIds of the ReferenceLine and YAxis do not match. The YAxis gets 0 as default axis id while for the ReferenceLine it's undefined.

It looks like this was introduced in version 2.4.0 when the default props of the ReferenceLine were removed.

@ckifer
Copy link
Member

ckifer commented Mar 10, 2023

I haven't checked yet but I certainly don't remember removing anything from ReferenceLine. Weird

@lukask-proxora
Copy link
Contributor Author

I think that was the PR: #3283

@ckifer
Copy link
Member

ckifer commented Mar 10, 2023

Got it thank you, I'll take a look when I have time

@lukask-proxora
Copy link
Contributor Author

lukask-proxora commented Mar 10, 2023

As a workaround you can set yAxisId={0} on the ReferenceLine

@ckifer
Copy link
Member

ckifer commented Mar 14, 2023

Basically this is the culprit

finalDomain = areas.reduce((result: number[], el: any) => {
if (
el.props[idKey] === axisId &&
ifOverflowMatches(el.props, 'extendDomain') &&
isNumber(el.props[key1]) &&
isNumber(el.props[key2])
) {
const value1 = el.props[key1];
const value2 = el.props[key2];
return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];
}
return result;
}, finalDomain);
}

A fatal flaw of Recharts is that it takes advantage of defaultProps in the fact that it reaches into element props from a reference to that element. Line 43 tries to get yAxisId - because it was removed from default props it is no longer always set to 0. Default parameters don't get set until that component is actually called/invoked/rendered.

export function findAllByType<

findByType is used to dig out children of a specific element type and reference their prop values before they have even been invoked in any way. This works when using defaultProps because it is static on the class/a property on the function component, but default params will not behave the same way. The only props that can be seen before invocation are the ones that are defined by the user (which isn't going to cut it).

All that said I'm going to revert the commit to fix this

@ckifer ckifer self-assigned this Mar 14, 2023
ckifer added a commit that referenced this issue Mar 14, 2023
…nd ReferenceLine since default props is deprecated (#3455)

…(#3283)"

This reverts commit ea13805.

<!--- Provide a general summary of your changes in the Title above -->

## Description

<!--- Describe your changes in detail -->

See comment here
#3438 (comment)

Basically recharts breaks down without defaultProps because it
references props set by defaultProps _outside_ of said component
(antipattern alert 🚫) before the components are initialized/invoked.
Default parameters do not get set until the component is run - before
that function components only have reference to the props sent by the
user.

This will be a huge undertaking to fix. For now revert the change.

Two other small changes with this revert:
* fixed annoying eslint issue
* added storybook test 

## Related Issue

<!--- This project only accepts pull requests related to open issues -->
<!--- If suggesting a new feature or change, please discuss it in an
issue first -->
<!--- If fixing a bug, there should be an issue describing it with steps
to reproduce -->
<!--- Please link to the issue here: -->
#3438

## Motivation and Context

<!--- Why is this change required? What problem does it solve? -->
bug introduced in 2.4.x

## How Has This Been Tested?

<!--- Please describe in detail how you tested your changes. -->
<!--- Include details of your testing environment, and the tests you ran
to -->
<!--- see how your change affects other areas of the code, etc. -->
* existing tests pass
* run on storybook
   * settings are now set correctly
   * add storybook test

## Screenshots (if appropriate):

![image](https://user-images.githubusercontent.com/25180830/224912521-7a73da23-87ec-434a-9236-f8a739705b90.png)


## Types of changes

<!--- What types of changes does your code introduce? Put an `x` in all
the boxes that apply: -->

- [x] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing
functionality to change)

## Checklist:

<!--- Go over all the following points, and put an `x` in all the boxes
that apply. -->
<!--- If you're unsure about any of these, don't hesitate to ask. We're
here to help! -->

- [x] My code follows the code style of this project.
- [ ] My change requires a change to the documentation.
- [ ] I have updated the documentation accordingly.
- [ ] I have added tests to cover my changes.
- [x] All new and existing tests passed.

Co-authored-by: Coltin Kifer <ckifer@amazon.com>
@ckifer
Copy link
Member

ckifer commented Mar 14, 2023

Merged in #3455

This will be released next minor version

@ckifer
Copy link
Member

ckifer commented Mar 15, 2023

Released in 2.5!

@idealistraj9
Copy link

idealistraj9 commented Feb 27, 2024

import React from 'react';
import { Icon } from 'react-icons-kit';
import { eyeOff } from 'react-icons-kit/feather/eyeOff';
import { eye } from 'react-icons-kit/feather/eye';

const CustomIcon = ({ icon = eyeOff, size = 20, ...props }) => {
  return <Icon icon={icon} size={size} {...props} />;
};

export default CustomIcon;

"use client";
import { useState } from "react";
import axios from 'axios';
import CustomIcon from "./Icon";
import { eyeOff } from 'react-icons-kit/feather/eyeOff';
import { eye } from 'react-icons-kit/feather/eye';
import { useRouter } from 'next/navigation'
import { toast } from "react-toastify";
import "react-toastify/dist/ReactToastify.css";
import { signIn } from "next-auth/react";

const LoginForm = ({ switchToSignupTab }: { switchToSignupTab: any }) => {
  const [showPassword, setShowPassword] = useState(false);
  const [email, setEmail] = useState("");
  const [password, setPassword] = useState("");
  const [result, setresult] = useState("");
  const type = showPassword ? "text" : "password";
  const icon = showPassword ? eye : eyeOff;
  const router = useRouter()

  const handleSignupClick = () => {
    switchToSignupTab();
    console.log("signup clicked");
  };

  const togglePasswordVisibility = () => {
    setShowPassword(!showPassword);
  };

  const handleLogin = async (e: { preventDefault: () => void; }) => {
    e.preventDefault();
    const result = await signIn("credentials", { username: email, password: password, redirect: true, callbackUrl: '/' })
  };

  return (
    <section className="shadow-none border-none outline-none">
      {/* {result} */}
      <div className="flex flex-col items-center justify-center h-full ">
        <div className="w-full bg-secondary rounded-lg shadow dark:border md:mt-0 sm:max-w-md xl:p-0 dark:bg-gray-800 dark:border-gray-700 ">
          <div className="p-6 space-y-4 md:space-y-6 sm:p-8">
            <h1 className="text-xl font-bold leading-tight tracking-tight text-gray-900 md:text-2xl dark:text-white">
              Melden Sie sich bei Ihrem Konto an
            </h1>
            <form className="space-y-4 md:space-y-6" onSubmit={handleLogin}>
              <div>
                <label
                  htmlFor="email"
                  className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
                >
                  Deine E-Mail
                </label>
                <input
                  type="email"
                  name="email"
                  id="email"
                  className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                  placeholder="name@firma.ch"
                  onChange={(e) => setEmail(e.target.value)}
                />
              </div>
              <div>
                <label
                  htmlFor="username"
                  className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
                >
                  Nutzername
                </label>
                <input
                  type="username"
                  name="username"
                  id="username"
                  className="bg-gray-50 border border-gray-300 text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                  placeholder="Nike"
                />
              </div>
              <div>
                <label
                  htmlFor="password"
                  className="block mb-2 text-sm font-medium text-gray-900 dark:text-white"
                >
                  Passwort
                </label>
                <div className="flex bg-white rounded-lg border-2 border-gray-300">
                  <input
                    type={type}
                    name="password"
                    id="password"
                    placeholder="••••••••"
                    className="bg-gray-50 border border-gray-300 border-none text-gray-900 sm:text-sm rounded-lg focus:ring-primary-600 focus:border-primary-600 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500"
                    required
                    onChange={(e) => setPassword(e.target.value)}
                  />

                  <button
                    type="button"
                    onClick={togglePasswordVisibility}
                    className="relative transform -translate-y-1/2 text-gray-400 focus:outline-none m-1"
                  >
                    <CustomIcon icon={icon} size={20} />
                  </button>
                </div>



              </div>
              <div className="flex items-center justify-between">
                <div className="flex items-start">
                  <div className="flex items-center h-5">
                    <input
                      id="remember"
                      aria-describedby="remember"
                      type="checkbox"
                      className="w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-primary-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-primary-600 dark:ring-offset-gray-800"
                    />
                  </div>
                  <div className="ml-3 text-sm">
                    <label
                      htmlFor="remember"
                      className="text-gray-500 dark:text-gray-300"
                    >
                      Erinnere dich an mich
                    </label>
                  </div>
                </div>
                <a
                  href="#"
                  className="text-sm font-medium text-primary-600 hover:underline dark:text-primary-500"
                >
                  Passwort vergessen?
                </a>
              </div>
              <button
                type="submit"
                className="w-full text-secondary bg-primary hover:bg-primary-700 focus:ring-4 focus:outline-none focus:ring-primary-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-primary-600 dark:hover:bg-primary-700 dark:focus:ring-primary-800"
              >
                anmelden
              </button>
              <p className="text-sm font-light text-gray-500 dark:text-gray-400">
                Sie haben noch kein Konto?{" "}
                <button
                  type="button"
                  onClick={handleSignupClick}
                  className="font-medium text-primary-600 hover:underline dark:text-primary-500"
                >
                  Registrieren
                </button>
              </p>
            </form>
          </div>
        </div>
      </div>
    </section>
  );
};

export default LoginForm;
Warning: Icon: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
    at Icon (webpack-internal:///(ssr)/./node_modules/react-icons-kit/Icon.js:84:23)
    at CustomIcon (webpack-internal:///(ssr)/./components/Icon.js:17:23)
    at button
    at div
    at div
    at form
    at div
    at div
    at div
    at section
    at LoginForm (webpack-internal:///(ssr)/./components/LoginForm.tsx:25:22)
    at div
    at div
    at div
    at Login (webpack-internal:///(ssr)/./app/(pages)/login/page.tsx:18:86)
    at StaticGenerationSearchParamsBailoutProvider (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/static-generation-searchparams-bailout-provider.js:15:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at div
    at div
    at SessionProvider (webpack-internal:///(ssr)/./node_modules/next-auth/react/index.js:429:26)
    at Providers (webpack-internal:///(ssr)/./components/Providers.tsx:14:22)
    at body
    at html
    at RootLayout (webpack-internal:///(ssr)/./app/layout.tsx:19:23)
    at Lazy
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at ReactDevOverlay (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:66:9)
    at HotReload (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:296:11)
    at Router (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:155:11)
    at ErrorBoundaryHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:99:9)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at AppRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:421:13)
    at Lazy
    at Lazy
    at F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:381577
    at F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:381577
    at ServerInsertedHTMLProvider (F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:39:17605)
Warning: SvgIcon: Support for defaultProps will be removed from function components in a future major release. Use JavaScript default parameters instead.
    at SvgIcon (webpack-internal:///(ssr)/./node_modules/react-icons-kit/SvgIcon.js:152:22)
    at i
    at Icon (webpack-internal:///(ssr)/./node_modules/react-icons-kit/Icon.js:84:23)
    at CustomIcon (webpack-internal:///(ssr)/./components/Icon.js:17:23)
    at button
    at div
    at div
    at form
    at div
    at div
    at div
    at section
    at LoginForm (webpack-internal:///(ssr)/./components/LoginForm.tsx:25:22)
    at div
    at div
    at div
    at Login (webpack-internal:///(ssr)/./app/(pages)/login/page.tsx:18:86)
    at StaticGenerationSearchParamsBailoutProvider (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/static-generation-searchparams-bailout-provider.js:15:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at InnerLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:239:11)
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at NotFoundErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:54:9)
    at NotFoundBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/not-found-boundary.js:62:11)
    at LoadingBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:313:11)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at InnerScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:151:9)
    at ScrollAndFocusHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:226:11)
    at RenderFromTemplateContext (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/render-from-template-context.js:15:44)
    at Lazy
    at OuterLayoutRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/layout-router.js:322:11)
    at Lazy
    at div
    at div
    at SessionProvider (webpack-internal:///(ssr)/./node_modules/next-auth/react/index.js:429:26)
    at Providers (webpack-internal:///(ssr)/./components/Providers.tsx:14:22)
    at body
    at html
    at RootLayout (webpack-internal:///(ssr)/./app/layout.tsx:19:23)
    at Lazy
    at RedirectErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:71:9)
    at RedirectBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/redirect-boundary.js:79:11)
    at ReactDevOverlay (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/internal/ReactDevOverlay.js:66:9)
    at HotReload (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/react-dev-overlay/hot-reloader-client.js:296:11)
    at Router (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:155:11)
    at ErrorBoundaryHandler (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:99:9)
    at ErrorBoundary (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/error-boundary.js:128:11)
    at AppRouter (webpack-internal:///(ssr)/./node_modules/next/dist/client/components/app-router.js:421:13)
    at Lazy
    at Lazy
    at F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:381577
    at F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:35:381577
    at ServerInsertedHTMLProvider (F:\PROJECT-2023\B2BMATCH\b2bmatch-ui-final\node_modules\next\dist\compiled\next-server\app-page.runtime.dev.js:39:17605)
please me to solve this

sorry for format asking help first time

@idealistraj9
Copy link

Basically this is the culprit

finalDomain = areas.reduce((result: number[], el: any) => {
if (
el.props[idKey] === axisId &&
ifOverflowMatches(el.props, 'extendDomain') &&
isNumber(el.props[key1]) &&
isNumber(el.props[key2])
) {
const value1 = el.props[key1];
const value2 = el.props[key2];
return [Math.min(result[0], value1, value2), Math.max(result[1], value1, value2)];
}
return result;
}, finalDomain);
}

A fatal flaw of Recharts is that it takes advantage of defaultProps in the fact that it reaches into element props from a reference to that element. Line 43 tries to get yAxisId - because it was removed from default props it is no longer always set to 0. Default parameters don't get set until that component is actually called/invoked/rendered.

export function findAllByType<

findByType is used to dig out children of a specific element type and reference their prop values before they have even been invoked in any way. This works when using defaultProps because it is static on the class/a property on the function component, but default params will not behave the same way. The only props that can be seen before invocation are the ones that are defined by the user (which isn't going to cut it).

All that said I'm going to revert the commit to fix this

can you help me in this code

@ckifer
Copy link
Member

ckifer commented Feb 27, 2024

@idealistraj9 please see #3615

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

No branches or pull requests

3 participants