Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
Drip
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Issue analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
backup
Drip
Commits
124f6cfc
Commit
124f6cfc
authored
6 years ago
by
Julia Friesel
Browse files
Options
Downloads
Patches
Plain Diff
Use nothing-changed helper in home to prevent unnecessary render
parent
dca286a1
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
components/home.js
+3
-1
3 additions, 1 deletion
components/home.js
helpers/db-unchanged.js
+3
-0
3 additions, 0 deletions
helpers/db-unchanged.js
lib/notifications.js
+1
-4
1 addition, 4 deletions
lib/notifications.js
with
7 additions
and
5 deletions
components/home.js
+
3
−
1
View file @
124f6cfc
...
...
@@ -11,6 +11,7 @@ import { getOrCreateCycleDay, getCycleDaysSortedByDate } from '../db'
import
{
getFertilityStatusForDay
}
from
'
../lib/sympto-adapter
'
import
styles
from
'
../styles
'
import
AppText
,
{
AppTextLight
}
from
'
./app-text
'
import
nothingChanged
from
'
../helpers/db-unchanged
'
export
default
class
Home
extends
Component
{
constructor
(
props
)
{
...
...
@@ -32,7 +33,8 @@ export default class Home extends Component {
this
.
cycleDays
.
addListener
(
this
.
updateState
)
}
updateState
=
()
=>
{
updateState
=
(
_
,
changes
)
=>
{
if
(
nothingChanged
(
changes
))
return
const
prediction
=
this
.
getBleedingPrediction
()
const
fertilityStatus
=
getFertilityStatusForDay
(
this
.
todayDateString
)
this
.
setState
({
...
...
This diff is collapsed.
Click to expand it.
helpers/db-unchanged.js
0 → 100644
+
3
−
0
View file @
124f6cfc
export
default
function
(
dbChanges
)
{
return
Object
.
values
(
dbChanges
).
every
(
changeArray
=>
changeArray
.
length
===
0
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
lib/notifications.js
+
1
−
4
View file @
124f6cfc
...
...
@@ -5,6 +5,7 @@ import Moment from 'moment'
import
{
settings
as
labels
}
from
'
../components/labels
'
import
{
getOrCreateCycleDay
,
getBleedingDaysSortedByDate
}
from
'
../db
'
import
cycleModule
from
'
./cycle
'
import
nothingChanged
from
'
../helpers/db-unchanged
'
export
default
function
setupNotifications
(
navigate
)
{
Notification
.
configure
({
...
...
@@ -80,7 +81,3 @@ function setupPeriodReminder() {
}
}
}
function
nothingChanged
(
dbChanges
)
{
return
Object
.
values
(
dbChanges
).
every
(
changeArray
=>
changeArray
.
length
===
0
)
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment