Giter Club home page Giter Club logo

Comments (7)

dosubot avatar dosubot commented on July 19, 2024 7

Hey there, @denzo! I'm here to help you with any bugs, questions, or contributions for Langflow. Let's work together to solve this issue.

To resolve the issue where Langflow shows a black screen on launch with a "Uncaught TypeError: debounce is not a function" error in the console, you need to ensure that the debounce function is correctly imported and used. The lodash package is used for the debounce function in Langflow.

Here is how you can correctly import and use the debounce function from the lodash package:

  1. Install the lodash package (if not already installed):

    npm install lodash
  2. Import the debounce function in your JavaScript/TypeScript file:

    import { debounce } from 'lodash';
  3. Use the debounce function:

    const debouncedFunction = debounce(yourFunction, delay);

Here is an example of how you might use it in a React component:

import React, { useCallback } from 'react';
import { debounce } from 'lodash';

const YourComponent = () => {
  const handleInputChange = useCallback(
    debounce((event) => {
      // Your debounced function logic here
      console.log(event.target.value);
    }, 300),
    []
  );

  return (
    <input type="text" onChange={handleInputChange} />
  );
};

export default YourComponent;

Ensure that you replace yourFunction with the actual function you want to debounce and delay with the debounce delay in milliseconds.

Additionally, you can refer to the src/frontend/src/utils/parameterUtils.ts file in Langflow for an example of how the debounce function is used:

import { debounce } from "lodash";
import { SAVE_DEBOUNCE_TIME } from "../constants/constants";
import { postCustomComponentUpdate } from "../controllers/API";
import { NodeDataType } from "../types/flow";

export const handleUpdateValues = async (name: string, data: NodeDataType) => {
  const code = data.node?.template?.code?.value;
  if (!code) {
    console.error("Code not found in the template");
    return;
  }

  const template = data.node?.template;
  if (!template) {
    console.error("No template found in the node.");
    return;
  }

  try {
    const res = await postCustomComponentUpdate(
      code,
      template,
      name,
      data.node?.template[name]?.value,
    );
    if (res.status === 200 && data.node?.template) {
      return res.data.template;
    }
  } catch (error) {
    console.error("Error occurred while updating the node:", error);
    throw error;
  }
};

export const debouncedHandleUpdateValues = debounce(
  handleUpdateValues,
  SAVE_DEBOUNCE_TIME,
);

By correctly importing and using the debounce function from the lodash package, you should be able to resolve the "Uncaught TypeError: debounce is not a function" error [1][2][3].

To continue talking to Dosu, mention @dosu.

from langflow.

mikelmao avatar mikelmao commented on July 19, 2024

I too am facing this issue @denzo

from langflow.

mindaxis avatar mindaxis commented on July 19, 2024

having the same issue, on chrome and brave, the html (in source) tells me that i have to activate javascript (all worked in the previous deploy) working with the railway template

from langflow.

msmygit avatar msmygit commented on July 19, 2024

I'm facing the same issue too!

from langflow.

jvsmithjr avatar jvsmithjr commented on July 19, 2024

I have the same problem. I installed it WSL and vmware machines. All new builds.

from langflow.

qiaolb avatar qiaolb commented on July 19, 2024

I encountered a similar problem
image

from langflow.

deitynoah avatar deitynoah commented on July 19, 2024

Capture

I guess this is the problem but I have no idea how to solve it. Incredibly frustrating.

In general I am unable to get any v1 pre release version running

from langflow.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.