Skip to content

Commit 647b6a0

Browse files
committed
bug fixes
1 parent 4610034 commit 647b6a0

File tree

5 files changed

+21
-14
lines changed

5 files changed

+21
-14
lines changed

web/src/drawing/drawOutcome/computeArguments/argsForDrawStatement.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,13 @@ export const argsForDrawStatement = ({
3737

3838
const width = outcomeWidth - 2 * outcomePaddingHorizontal
3939

40+
const statement = outcome ? outcome.content : ''
41+
4042
// if the card is rendering either assignees, tags, or progress bar:
4143
const isRenderingOtherMetadata =
42-
outcome.members?.length > 0 ||
43-
outcome.tags?.length > 0 ||
44-
outcome.computedAchievementStatus?.simple ===
44+
outcome?.members?.length > 0 ||
45+
outcome?.tags?.length > 0 ||
46+
outcome?.computedAchievementStatus?.simple ===
4547
ComputedSimpleAchievementStatus.PartiallyAchieved
4648

4749
const args: Parameters<typeof drawStatement>[0] = {
@@ -52,7 +54,7 @@ export const argsForDrawStatement = ({
5254
yPosition,
5355
zoomLevel,
5456
width,
55-
statement: outcome.content,
57+
statement,
5658
color: STATEMENT_FONT_COLOR,
5759
ctx,
5860
}

web/src/redux/persistent/projects/realtime-info-signal/actions.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import { CellIdString } from "../../../../types/shared"
2+
13
const SEND_REALTIME_INFO = 'SEND_REALTIME_INFO'
24
const SEND_EXIT_PROJECT_SIGNAL = 'SEND_EXIT_PROJECT_SIGNAL'
35

@@ -8,10 +10,10 @@ function triggerRealtimeInfoSignal() {
810
}
911
}
1012

11-
function sendExitProjectSignal() {
13+
function sendExitProjectSignal(projectId: CellIdString) {
1214
return {
1315
type: SEND_EXIT_PROJECT_SIGNAL,
14-
payload: {},
16+
payload: projectId,
1517
}
1618
}
1719

web/src/redux/persistent/projects/realtime-info-signal/middleware.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ import ProjectsZomeApi from '../../../../api/projectsApi'
1616
import { getAppWs } from '../../../../hcWebsockets'
1717
import { cellIdFromString } from '../../../../utils'
1818
import { RootState } from '../../../reducer'
19+
import { CellIdString } from '../../../../types/shared'
1920

2021
const isOneOfRealtimeInfoAffectingActions = (action) => {
2122
const { type } = action
@@ -30,7 +31,7 @@ const isOneOfRealtimeInfoAffectingActions = (action) => {
3031
)
3132
}
3233

33-
const isProjectExitAction = (action) => {
34+
const isProjectExitAction = (action: { type: string }) => {
3435
const { type } = action
3536
return type === SEND_EXIT_PROJECT_SIGNAL
3637
}
@@ -39,28 +40,30 @@ const isProjectExitAction = (action) => {
3940
const realtimeInfoWatcher = (store) => {
4041
// return the action handler middleware
4142
return (next) => async (action) => {
42-
// console.log(store.getState())
4343
if (isOneOfRealtimeInfoAffectingActions(action)) {
4444
const appWebsocket = await getAppWs()
4545
const projectsZomeApi = new ProjectsZomeApi(appWebsocket)
4646
let result = next(action)
4747
if (appWebsocket.client.socket.readyState === appWebsocket.client.socket.OPEN) {
4848
let state: RootState = store.getState()
4949
const payload = getRealtimeInfo(state)
50-
const cellId = cellIdFromString(payload.projectId)
51-
await projectsZomeApi.realtimeInfoSignal.send(cellId, payload)
50+
// there is a chance that the project has been exited
51+
// and thus this need not be fired
52+
if (payload.projectId) {
53+
const cellId = cellIdFromString(payload.projectId)
54+
await projectsZomeApi.realtimeInfoSignal.send(cellId, payload)
55+
}
5256
}
5357
return result
5458
} else if (isProjectExitAction(action)) {
5559
const appWebsocket = await getAppWs()
5660
const projectsZomeApi = new ProjectsZomeApi(appWebsocket)
57-
let state: RootState = store.getState()
58-
const cellIdString = state.ui.activeProject
5961
const payload = {
6062
projectId: '',
6163
outcomeBeingEdited: null,
6264
outcomeExpandedView: null,
6365
}
66+
const cellIdString: CellIdString = action.payload
6467
const cellId = cellIdFromString(cellIdString)
6568
// TODO: catch and log error, but don't
6669
// await this call

web/src/routes/ProjectView/PriorityView/PriorityUniversal/PriorityUniversal.component.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ const PriorityUniversal: React.FC<PriorityUniversalProps> = ({
315315
// pending->true status
316316
const [pendingList, setPendingList] = useState([])
317317
// a little function to help us with reordering the result
318-
const reorder = (list, startIndex, endIndex) => {
318+
const reorder = (list: ActionHashB64[], startIndex: number, endIndex: number) => {
319319
const result = Array.from(list)
320320
const [removed] = result.splice(startIndex, 1)
321321
result.splice(endIndex, 0, removed)

web/src/routes/ProjectView/ProjectView.connector.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ function mapDispatchToProps(
6262
dispatch(setActiveEntryPoints(entryPointActionHashes)),
6363
resetProjectView: () => {
6464
// send this signal so peers know you left project
65-
dispatch(sendExitProjectSignal())
65+
dispatch(sendExitProjectSignal(cellIdString))
6666
dispatch(closeExpandedView())
6767
dispatch(closeOutcomeForm())
6868
dispatch(unselectAll())

0 commit comments

Comments
 (0)