Skip to content

Commit 0fc25f1

Browse files
authored
Various performance improvements
Various performance improvements
2 parents 0bb6be8 + 58a3b2b commit 0fc25f1

26 files changed

+25321
-13170
lines changed

.babelrc

Lines changed: 0 additions & 13 deletions
This file was deleted.

.travis.yml

Lines changed: 34 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,37 @@
11
language: node_js
2+
23
node_js:
3-
- "10"
4-
before_script:
5-
- npm run bootstrap
6-
- npm run build
7-
before_deploy:
8-
- npx version-from-git --travis --no-git-tag-version
9-
- cp -r packages/component/lib .
4+
- "10"
5+
6+
before_install:
7+
- npm install
8+
- sudo apt-get install jq
9+
- npx version-from-git --travis --no-git-tag-version
10+
- git checkout -b temp-ci
11+
- lerna version --force-publish --no-git-tag-version --no-push --yes `cat package.json | jq -r .version`
12+
13+
install:
14+
- npm run bootstrap
15+
- npm run build
16+
1017
deploy:
11-
- provider: npm
12-
api_key:
13-
secure: "TmSsQrb7ujvlLd6K04nW7BSaKbFu2QtuEGQguhpYQ2hKDhZrfWizFP7De3Zdwvg+CVWDjTPMXkdrhOd7gpPwKOCoGTl/k6oVLpGUu640GbZmTqik22MIGdS8gb9etFpzRNQiJuKYVzMZtDeClA4GvhGra3L5JZKJthPOdLVX7GNsRqtjhrLMsV/Zdpl4YfPfwQqYP9Nvm+gdwJni9qFTdCdn558kOitAde1/cuG2awBmvDKd//2vI0RE/DNrMZRBOWRtdWr4dZAuAdpA0v4qWtFqxPn9k6FxkW7UF5pJXQKWugworsPo6aNOz2KTQlfhWcX6Rz45j8IVWXgrnyO3WEM/oWSpo7I3oBGdH6TXO5IcZ1PBIeo9rvdCpByrk8Z38PMWrcbx3RMR1rQlE7fAuzAh7TD89R3vBrMUyElbQnjlgjNrvC3zdNLDVVFFFTRbEwwOBG7VdkUXuXW4NpHmv2fe49Sw0RvAmvaOFAB0ogUXIhkzPilpkr5CLEFzwyYvRup9/q0Y7jwNwHClHUecsFJDIPygaV8z3WDmev+bnKi9+DhygPlwTFQJCHs486+dj9MCYnUkCak+pgKesQSQ/R7kM9g9oOD77wyTMlwtj5KwSnCuwaD9GuvNwplBSKJpM6tYqqfGNd8GJAUHqR0aIx4DUbXUKAM4P5wbfTMyVbo="
14-
15-
on:
16-
branch: master
17-
skip_cleanup: true
18-
tag: master
19-
- provider: npm
20-
api_key:
21-
secure: "TmSsQrb7ujvlLd6K04nW7BSaKbFu2QtuEGQguhpYQ2hKDhZrfWizFP7De3Zdwvg+CVWDjTPMXkdrhOd7gpPwKOCoGTl/k6oVLpGUu640GbZmTqik22MIGdS8gb9etFpzRNQiJuKYVzMZtDeClA4GvhGra3L5JZKJthPOdLVX7GNsRqtjhrLMsV/Zdpl4YfPfwQqYP9Nvm+gdwJni9qFTdCdn558kOitAde1/cuG2awBmvDKd//2vI0RE/DNrMZRBOWRtdWr4dZAuAdpA0v4qWtFqxPn9k6FxkW7UF5pJXQKWugworsPo6aNOz2KTQlfhWcX6Rz45j8IVWXgrnyO3WEM/oWSpo7I3oBGdH6TXO5IcZ1PBIeo9rvdCpByrk8Z38PMWrcbx3RMR1rQlE7fAuzAh7TD89R3vBrMUyElbQnjlgjNrvC3zdNLDVVFFFTRbEwwOBG7VdkUXuXW4NpHmv2fe49Sw0RvAmvaOFAB0ogUXIhkzPilpkr5CLEFzwyYvRup9/q0Y7jwNwHClHUecsFJDIPygaV8z3WDmev+bnKi9+DhygPlwTFQJCHs486+dj9MCYnUkCak+pgKesQSQ/R7kM9g9oOD77wyTMlwtj5KwSnCuwaD9GuvNwplBSKJpM6tYqqfGNd8GJAUHqR0aIx4DUbXUKAM4P5wbfTMyVbo="
22-
23-
on:
24-
tags: true
25-
skip_cleanup: true
26-
- provider: pages
27-
skip-cleanup: true
28-
github-token:
29-
secure: "NlS8bKqgC9ocfB5S4EsE1n+lq1H1Kyf83pWoQFuZIy33wILcyhTl+ypsSPQ2rgOMw9di+DeJrlGEddioKLvvKr11suWigNJ54pD5yFft3TkrytbFDM3974WkHiQKFSim11nwmueHqJdOfvfKyNajRBj0XkVHYiLsZilugC+ClWqs3BtL4thu90ZXVjsnDBz1z6FOQHDaM51tVEzsxkxEakbRT9ASLWGGP6UPvHGzmbgjRViGu5NOUHougZfJep0pRvQHFCDMolRfGh48yhOR5moyDbD3Rg71dmF39Q/SY5eKYEImiOpnryuEY8Cf0LPQq8rlkJ+ZOfmnbaO3oQxQlnFlsk9O0I58lZ7G+6cF/fzOi1Y1XsDNFGSrH7T9wtoTyErWh6V/tvDNCmQHNu1XzWbqGl9xGYXafNtE871fvtkGizuIxvtKYmCIfrmlZyE00SLM+ScnR0aEudXUSN+1CLjei23NgXmOEn+mhwcsBymnFfB34fz5DzkyHj6FE0uWTBV/7J8Pt7TawKxNh02bJ1eUzYWnGcsSPCIFdu0VZ3TcIdjrP0VyuB8TvJuwtb3YI0sK+NmgFiRD+ajBMasokzK+rG+ydlYhzqpdNf2z4G3UfKLPxlbQn3TExigncr7TVm4eWqmI6+E0knTW70dZGs8lCuQ3DMgW9/hUGLGD+bg="
30-
on:
31-
branch: master
32-
local-dir: packages/playground/build
33-
- provider: releases
34-
api_key:
35-
secure: "NlS8bKqgC9ocfB5S4EsE1n+lq1H1Kyf83pWoQFuZIy33wILcyhTl+ypsSPQ2rgOMw9di+DeJrlGEddioKLvvKr11suWigNJ54pD5yFft3TkrytbFDM3974WkHiQKFSim11nwmueHqJdOfvfKyNajRBj0XkVHYiLsZilugC+ClWqs3BtL4thu90ZXVjsnDBz1z6FOQHDaM51tVEzsxkxEakbRT9ASLWGGP6UPvHGzmbgjRViGu5NOUHougZfJep0pRvQHFCDMolRfGh48yhOR5moyDbD3Rg71dmF39Q/SY5eKYEImiOpnryuEY8Cf0LPQq8rlkJ+ZOfmnbaO3oQxQlnFlsk9O0I58lZ7G+6cF/fzOi1Y1XsDNFGSrH7T9wtoTyErWh6V/tvDNCmQHNu1XzWbqGl9xGYXafNtE871fvtkGizuIxvtKYmCIfrmlZyE00SLM+ScnR0aEudXUSN+1CLjei23NgXmOEn+mhwcsBymnFfB34fz5DzkyHj6FE0uWTBV/7J8Pt7TawKxNh02bJ1eUzYWnGcsSPCIFdu0VZ3TcIdjrP0VyuB8TvJuwtb3YI0sK+NmgFiRD+ajBMasokzK+rG+ydlYhzqpdNf2z4G3UfKLPxlbQn3TExigncr7TVm4eWqmI6+E0knTW70dZGs8lCuQ3DMgW9/hUGLGD+bg="
36-
on:
37-
tags: true
38-
skip_cleanup: true
18+
- provider: scripts
19+
script: bash scripts/lerna_publish
20+
on:
21+
branch: master
22+
skip_cleanup: true
23+
24+
- provider: pages
25+
skip-cleanup: true
26+
github-token:
27+
secure: "NlS8bKqgC9ocfB5S4EsE1n+lq1H1Kyf83pWoQFuZIy33wILcyhTl+ypsSPQ2rgOMw9di+DeJrlGEddioKLvvKr11suWigNJ54pD5yFft3TkrytbFDM3974WkHiQKFSim11nwmueHqJdOfvfKyNajRBj0XkVHYiLsZilugC+ClWqs3BtL4thu90ZXVjsnDBz1z6FOQHDaM51tVEzsxkxEakbRT9ASLWGGP6UPvHGzmbgjRViGu5NOUHougZfJep0pRvQHFCDMolRfGh48yhOR5moyDbD3Rg71dmF39Q/SY5eKYEImiOpnryuEY8Cf0LPQq8rlkJ+ZOfmnbaO3oQxQlnFlsk9O0I58lZ7G+6cF/fzOi1Y1XsDNFGSrH7T9wtoTyErWh6V/tvDNCmQHNu1XzWbqGl9xGYXafNtE871fvtkGizuIxvtKYmCIfrmlZyE00SLM+ScnR0aEudXUSN+1CLjei23NgXmOEn+mhwcsBymnFfB34fz5DzkyHj6FE0uWTBV/7J8Pt7TawKxNh02bJ1eUzYWnGcsSPCIFdu0VZ3TcIdjrP0VyuB8TvJuwtb3YI0sK+NmgFiRD+ajBMasokzK+rG+ydlYhzqpdNf2z4G3UfKLPxlbQn3TExigncr7TVm4eWqmI6+E0knTW70dZGs8lCuQ3DMgW9/hUGLGD+bg="
28+
on:
29+
branch: master
30+
local-dir: packages/playground/build
31+
32+
- provider: releases
33+
api_key:
34+
secure: "NlS8bKqgC9ocfB5S4EsE1n+lq1H1Kyf83pWoQFuZIy33wILcyhTl+ypsSPQ2rgOMw9di+DeJrlGEddioKLvvKr11suWigNJ54pD5yFft3TkrytbFDM3974WkHiQKFSim11nwmueHqJdOfvfKyNajRBj0XkVHYiLsZilugC+ClWqs3BtL4thu90ZXVjsnDBz1z6FOQHDaM51tVEzsxkxEakbRT9ASLWGGP6UPvHGzmbgjRViGu5NOUHougZfJep0pRvQHFCDMolRfGh48yhOR5moyDbD3Rg71dmF39Q/SY5eKYEImiOpnryuEY8Cf0LPQq8rlkJ+ZOfmnbaO3oQxQlnFlsk9O0I58lZ7G+6cF/fzOi1Y1XsDNFGSrH7T9wtoTyErWh6V/tvDNCmQHNu1XzWbqGl9xGYXafNtE871fvtkGizuIxvtKYmCIfrmlZyE00SLM+ScnR0aEudXUSN+1CLjei23NgXmOEn+mhwcsBymnFfB34fz5DzkyHj6FE0uWTBV/7J8Pt7TawKxNh02bJ1eUzYWnGcsSPCIFdu0VZ3TcIdjrP0VyuB8TvJuwtb3YI0sK+NmgFiRD+ajBMasokzK+rG+ydlYhzqpdNf2z4G3UfKLPxlbQn3TExigncr7TVm4eWqmI6+E0knTW70dZGs8lCuQ3DMgW9/hUGLGD+bg="
35+
on:
36+
tags: true
37+
skip_cleanup: true

CHANGELOG.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,25 @@ The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/)
55
and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.html).
66

77
## [Unreleased]
8+
### Added
9+
- `AutoHideFollowButton`: will now hide when it start animating scroll position
10+
- `BasicScrollToBottom`: will now pass `debounce` and `threshold` to `Composer`, fix [#2](https://github.com/compulim/react-scroll-to-bottom/issues/2)
11+
- `Composer`: `debounce` prop to control debouncing on `onScroll` event, default to `17`
12+
- `FunctionContext`: `scrollTo` now support `"bottom"`, in addition to a `number`, fix [#1](https://github.com/compulim/react-scroll-to-bottom/issues/1)
13+
- This will help when animating scroll position while new content was added to the panel
14+
- `FunctionContext`: `scrollToStart` function to scroll to the start, depends on `mode`
15+
- `StateContext`: `animating` returns `true` if the scroll position is being animated
16+
- `StateContext`: `atStart` indicates if the scroll position is at the start or not, depend on `mode`
17+
18+
### Changed
19+
- Performance improvements
20+
- `Context` is now separated into `FunctionContext`, `InternalContext` and `StateContext` for better performance and reduce exposure
21+
- `FunctionContext` is static and only hold functions for manipulating the panel
22+
- `InternalContext` is static and for internal use (to overcome shortcomings of `React.createRef`)
23+
- `StateContext` is dynamic and change when scroll position change
24+
- `StateContext` will now only update if there are any meaningful changes
25+
- Added `displayName` to context
26+
- [`lerna`](https://npmjs.com/package/lerna) bumped from `2.11.0` to `3.4.3`
827

928
## [1.1.0] - 2018-06-22
1029
### Added

README.md

Lines changed: 24 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,27 +36,45 @@ export default props =>
3636
| Name | Default | Description |
3737
| - | - | - |
3838
| `className` | | Set the class name for the root element |
39+
| `debounce` | `17` | Set the debounce for tracking the `onScroll` event |
3940
| `followButtonClassName` | | Set the class name for the follow button |
4041
| `mode` | `"bottom"` | Set it to `"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top |
4142
| `scrollViewClassName` | | Set the class name for the container element that house all `props.children` |
4243

4344
## Context
4445

46+
We use 2 different contexts with different performance characteristics to provide better overall performance. [Function context](#function-context) contains immutable functions. [State context](#state-context) may change when the user scroll the panel.
47+
48+
### Function context
49+
50+
This context contains functions used to manipulate the container. And will not update throughout the lifetime of the composer.
51+
52+
| Name | Type | Description |
53+
| - | - | - |
54+
| `scrollTo` | `(scrollTop: number | 'bottom') => void` | Scroll panel to specified position |
55+
| `scrollToBottom` | `() => void` | Scroll panel to bottom |
56+
| `scrollToEnd` | `() => void` | Scroll panel to end (depends on `mode`) |
57+
| `scrollToStart` | `() => void` | Scroll panel to start (depends on `mode`) |
58+
| `scrollToTop` | `() => void` | Scroll panel to top |
59+
60+
### State context
61+
62+
This context contains state of the container.
63+
4564
| Name | Type | Description |
4665
| - | - | - |
66+
| `animating` | `boolean` | `true` if the panel is animating scroll effect |
4767
| `atBottom` | `boolean` | `true` if the panel is currently near bottom (see `threshold`) |
48-
| `atEnd` | `boolean` | `true` if the panel is currently near the end (see `mode` and `threshold` |
68+
| `atEnd` | `boolean` | `true` if the panel is currently near the end (depends on `mode`, see `mode` and `threshold` |
69+
| `atStart` | `boolean` | `true` if the panel is currently near the start (depends on `mode`, see `threshold`) |
4970
| `atTop` | `boolean` | `true` if the panel is currently near top (see `threshold`) |
5071
| `mode` | `string` | `"bottom"` for scroll-to-bottom, `"top"` for scroll-to-top |
51-
| `scrollTo` | `(scrollTop: number) => void` | Scroll panel to specified position |
52-
| `scrollToBottom` | `() => void` | Scroll panel to bottom |
53-
| `scrollToEnd` | `() => void` | Scroll panel to end |
54-
| `scrollToTop` | `() => void` | Scroll panel to top |
5572
| `threshold` | `number` | Threshold in pixels to consider the panel is near top/bottom, read-only and only set thru `props` |
5673

5774
# Road map
5875

59-
* Easier customization for "scroll to bottom" button
76+
- [x] Easier customization for "scroll to bottom" button
77+
- [ ] Debounce on showing "scroll to bottom" button
6078

6179
# Contributions
6280

lerna.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"lerna": "2.11.0",
2+
"lerna": "3.4.3",
33
"packages": [
44
"packages/*"
55
],

0 commit comments

Comments
 (0)