Skip to content

Commit 656dda9

Browse files
committed
feat(tasks): do task container queries properly
depends on updates to `feathers-action` and `feathers-action-react` - root-systems/feathers-action#19 - https://github.com/ahdinosaur/feathers-action-react
1 parent e2bc835 commit 656dda9

File tree

4 files changed

+15
-9
lines changed

4 files changed

+15
-9
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,8 @@
6565
"dog-names": "^1.0.2",
6666
"dogstack": "^0.4.0",
6767
"dogstack-agents": "^0.4.3",
68-
"feathers-action": "^2.2.0",
69-
"feathers-action-react": "github:ahdinosaur/feathers-action-react#luddite",
68+
"feathers-action": "^2.3.0",
69+
"feathers-action-react": "^2.2.1",
7070
"feathers-errors": "^2.6.2",
7171
"feathers-hooks-common": "^3.0.0",
7272
"feathers-knex": "^2.6.3",

tasks/components/SetupGroupTask.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ export default (props) => {
1818

1919
const { profile, sourceRelationships } = contextAgent
2020

21-
console.log(sourceRelationships)
21+
console.log('sourceRelationships', sourceRelationships)
2222

2323
const steps = [
2424
{

tasks/containers/SetupGroupTask.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export default compose(
2323
var queries = []
2424
// once we have the task plan, query for the context agent
2525
const { taskPlan } = props
26+
2627
if (taskPlan) {
2728
const { params: { contextAgentId, contextAgent } } = taskPlan
2829
queries.push({
@@ -48,6 +49,7 @@ export default compose(
4849

4950
if (contextAgent) {
5051
const { sourceRelationships } = contextAgent
52+
5153
sourceRelationships.forEach(relationship => {
5254
const { targetId } = relationship
5355
queries.push({
@@ -77,11 +79,9 @@ export default compose(
7779
return queries
7880
},
7981
shouldQueryAgain: (props, status) => {
80-
console.log('querrrrrrrrrrry')
8182
if (status.isPending) return false
82-
debugger
8383

84-
const { taskPlan } = props.selected
84+
const { taskPlan } = props.ownProps
8585

8686
// wait for task plan before re-query
8787
if (isNil(taskPlan)) return false
@@ -90,7 +90,6 @@ export default compose(
9090
const contextAgent = getContextAgentFromTaskPlan(taskPlan)
9191

9292
if (isNil(contextAgent)) return true
93-
debugger
9493
if (anyTargetsAreNil(contextAgent)) return true
9594

9695
return false

tasks/containers/TaskWorker.js

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import h from 'react-hyperscript'
2-
import { isNil } from 'ramda'
2+
import { isNil, pipe, filter, keys, length, gte, propEq, not } from 'ramda'
33
import { connect as connectFeathers } from 'feathers-action-react'
44
import { compose } from 'recompose'
55
import { push } from 'react-router-redux'
@@ -75,7 +75,7 @@ export default compose(
7575
// re-query when we haven't gotten back taskWork
7676
const { taskWork } = taskPlan
7777

78-
if (isNil(taskWork)) return true
78+
if (not(hasQueriedTaskWorks(status.requests))) return true
7979

8080
return false
8181
}
@@ -100,3 +100,10 @@ export default compose(
100100
actions.router.push(nextRoute)
101101
}
102102
})
103+
104+
const hasQueriedTaskWorks = pipe(
105+
filter(propEq('service', 'taskWorks')),
106+
keys,
107+
length,
108+
gte(1)
109+
)

0 commit comments

Comments
 (0)