Giter Club home page Giter Club logo

Comments (3)

linear avatar linear commented on June 18, 2024

HIG-4668 Disable polling when sorting by something besides timestamp

from highlight.

greptile-apps avatar greptile-apps commented on June 18, 2024

To disable polling when sorting by something besides timestamp, modify the useEffect hook in frontend/src/util/search.ts. Add a condition to check the sorting criteria and skip polling if it's not by timestamp.

useEffect(() => {
  if (skip || sortingCriteria !== 'timestamp') {
    return
  }

  // setup a polling interval for sessions after the current date range
  const poll = async () => {
    const variables = variableFn()
    if (variables === undefined) {
      log('search.ts', 'skipping polling for custom time selection')
      pollTimeout.current = setTimeout(
        poll,
        POLL_INTERVAL,
      ) as unknown as number
      return
    }
    const currentTimeout = pollTimeout.current
    const result = await moreDataQuery({ variables })
    if (pollTimeout.current === currentTimeout) {
      const count = getResultCount(result)
      if (count !== undefined) {
        setNumMore(count)
      }
      pollTimeout.current = setTimeout(
        poll,
        POLL_INTERVAL,
      ) as unknown as number
    }
  }
  pollTimeout.current = setTimeout(
    poll,
    POLL_INTERVAL,
  ) as unknown as number
  return () => {
    setNumMore(0)
    clearTimeout(pollTimeout.current)
    pollTimeout.current = undefined
  }
}, [getResultCount, moreDataQuery, variableFn, skip, sortingCriteria])

References

/frontend/src/util/search.ts

Ask Greptile

from highlight.

zane avatar zane commented on June 18, 2024

@ccschmitz You mentioned the wrong Zane. I don't contribute to this project.

from highlight.

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.