Giter Club home page Giter Club logo

Comments (5)

kriegalex avatar kriegalex commented on July 18, 2024

I have been able to reproduce.

The pattern is always the same :

  1. Select a new input search
  2. The autocomplete works
  3. Empty the cell
  4. Type something that gives the same autocomplete result (props.point.queryText)
  5. Select the same result
  6. Input fields doesn't switch to autocomplete suggestion
  7. Using console.log, we see that useEffect => setText is not triggered to update the text from "input" to "queryText"

from graphhopper-maps.

kriegalex avatar kriegalex commented on July 18, 2024
if (action instanceof InvalidatePoint) {
  const points = QueryStore.replacePoint(state.queryPoints, {
    ...action.point,
    isInitialized: false,
    queryText: ''
  });
  return {
    ...state,
    queryPoints: points,
  };
} else if (action instanceof ClearPoints) {

Query text must be emptied for the change to be registered by useEffect().

useEffect(() => {
  setText(props.point.queryText);
  console.log('useEffect: '+props.point.queryText);
}, [props.point.queryText]);

Is that correct ? I'm still learning Typescript and web development.

from graphhopper-maps.

karussell avatar karussell commented on July 18, 2024

Oh, nice. Indeed the first code you mentioned already fixes the problem and is what we need here, I guess! Feel free to create a pull request or I can mention you in the commit to credit you properly :)

from graphhopper-maps.

karussell avatar karussell commented on July 18, 2024

Unfortunately I had to revert it as it breaks editing the input text: 1. search for something and click the suggestion. 2. click again on the input element and whatever you type the input will be (incorrectly) cleared before it.

from graphhopper-maps.

kriegalex avatar kriegalex commented on July 18, 2024

Understood. Makes total sense. Next time, I'll mark it as untested explicitely (more like an hint to follow).

from graphhopper-maps.

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.