Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
editoria
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Container Registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Yannis Barlas
editoria
Commits
f2022384
Commit
f2022384
authored
8 years ago
by
john
Browse files
Options
Downloads
Patches
Plain Diff
add willreceiveprops to handle async call to get fragments
parent
b1184a9d
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
api/db/dev/.gitkeep
+0
-0
0 additions, 0 deletions
api/db/dev/.gitkeep
app/components/BookBuilder/BookBuilder.jsx
+18
-15
18 additions, 15 deletions
app/components/BookBuilder/BookBuilder.jsx
with
18 additions
and
15 deletions
api/db/dev/.gitkeep
deleted
100644 → 0
+
0
−
0
View file @
b1184a9d
This diff is collapsed.
Click to expand it.
app/components/BookBuilder/BookBuilder.jsx
+
18
−
15
View file @
f2022384
...
@@ -32,6 +32,8 @@ export class BookBuilder extends React.Component {
...
@@ -32,6 +32,8 @@ export class BookBuilder extends React.Component {
const
{
actions
,
book
}
=
this
.
props
const
{
actions
,
book
}
=
this
.
props
const
{
getCollections
,
getFragments
,
getTeams
,
getUsers
}
=
actions
const
{
getCollections
,
getFragments
,
getTeams
,
getUsers
}
=
actions
console
.
log
(
'
props
'
,
this
.
props
)
getUsers
().
then
(
getUsers
().
then
(
()
=>
getTeams
()
()
=>
getTeams
()
).
then
(
).
then
(
...
@@ -41,23 +43,24 @@ export class BookBuilder extends React.Component {
...
@@ -41,23 +43,24 @@ export class BookBuilder extends React.Component {
}
}
).
then
(
).
then
(
()
=>
{
()
=>
{
console
.
log
(
book
.
id
)
if
(
book
.
id
)
{
if
(
book
.
id
)
getFragments
(
book
)
console
.
log
(
'
has book id
'
)
getFragments
(
book
)
}
}
}
)
)
}
}
// componentWillReceiveProps (nextProps) {
componentWillReceiveProps
(
nextProps
)
{
// const { actions, book } = nextProps
console
.
log
(
'
next
'
,
nextProps
)
// const { getFragments } = actions
const
{
actions
,
book
}
=
nextProps
// //
const
{
getFragments
}
=
actions
// console.log(book)
// console.log(this.props)
if
(
book
.
id
&&
book
.
id
!==
this
.
props
.
book
.
id
)
{
// //
console
.
log
(
'
here
'
)
// // if (book.id && book.id !== this.props.id) {
getFragments
(
book
)
// // // getFragments(book)
}
// // }
}
// }
componentDidMount
()
{
componentDidMount
()
{
// I'm using the ref inside the render function it was created in
// I'm using the ref inside the render function it was created in
...
@@ -252,12 +255,12 @@ BookBuilder.propTypes = {
...
@@ -252,12 +255,12 @@ BookBuilder.propTypes = {
}
}
function
mapStateToProps
(
state
,
ownProps
)
{
function
mapStateToProps
(
state
,
ownProps
)
{
console
.
log
(
state
)
let
book
=
_
.
find
(
state
.
collections
,
function
(
c
)
{
let
book
=
_
.
find
(
state
.
collections
,
function
(
c
)
{
return
c
.
id
===
ownProps
.
params
.
id
return
c
.
id
===
ownProps
.
params
.
id
})
})
console
.
log
(
state
)
let
chapters
=
_
.
sortBy
(
_
.
filter
(
state
.
fragments
,
function
(
f
)
{
let
chapters
=
_
.
sortBy
(
_
.
filter
(
state
.
fragments
,
function
(
f
)
{
return
f
.
book
===
book
.
id
&&
f
.
id
&&
!
f
.
deleted
return
f
.
book
===
book
.
id
&&
f
.
id
&&
!
f
.
deleted
}),
'
index
'
)
}),
'
index
'
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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