Skip to content

Add an option to disable tracking #155

@yakunins

Description

@yakunins

Hi @frontendphil

The main idea here is that user may turn on and off tracking if react-stick is placed outside the viewport (with his own preferred technique).

Proposal

Add property disableTracking to allow user disable tracking.

Or, which is worse from compatibility POV, rename property updateOnAnimationFrame to updateOn with values:

  1. idleCallback (default)
  2. animationFrame
  3. never

Why?

Right now watcher constantly tracks position of the anchor, taking up to 50% CPU performance in idleCallbacks in case of 200 react-stick instances (on my PC). Even if node itself is hidden (null)!

This may be seen straight on demo page. In case sticky node visible CPU usage goes twice higher.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions