Skip to content

Commit

Permalink
bug fix caused by outdated redux store
Browse files Browse the repository at this point in the history
  • Loading branch information
wds4 committed Jun 24, 2024
1 parent 51ee1b1 commit 641699f
Show file tree
Hide file tree
Showing 4 changed files with 41 additions and 1 deletion.
25 changes: 25 additions & 0 deletions src/redux/features/grapevine/slice.js
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,30 @@ export const grapevineSlice = createSlice({
},
},
reducers: {
createContentDiscoveryControlPanel: (state, action) => { // patch bug for users who logged in prior to addition of controlPanels.contentDiscovery
console.log('createContentDiscoveryControlPanel')
state.controlPanels.contentDiscovery = {
rigor: defContDiscRigor,
contextualEndorsements: {
score: {
fire: defFireInterpScore,
thumbUp: defThumbUpInterpScore,
thumbDown: defThumbDownInterpScore,
},
confidence: defContextualEndorsementInterpCon,
},
wikiReactions: {
likes: {
score: defContextualWikiLikeInterpScore,
confidence: defContextualWikiLikeInterpCon,
},
dislikes: {
score: defContextualWikiDislikeInterpScore,
confidence: defContextualWikiDislikeInterpCon,
},
},
}
},
// Content Discovery
updateContentDiscoveryRigor: (state, action) => {
state.controlPanels.contentDiscovery.rigor = action.payload
Expand Down Expand Up @@ -252,6 +276,7 @@ export const grapevineSlice = createSlice({
})

export const {
createContentDiscoveryControlPanel,
updateContentDiscoveryRigor,
updateAttenuationFactor,
updateDunbarNumber,
Expand Down
2 changes: 2 additions & 0 deletions src/views/contentDiscovery/about/About.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { CContainer, CNavLink } from '@coreui/react'
import React from 'react'
import { useDispatch } from 'react-redux'
import { updateNpub } from 'src/redux/features/siteNavigation/slice'
import ContentDiscoveryListener from '../../../helpers/listeners/ContentDiscoveryListener'

const ContentDiscoveryAbout = () => {
const dispatch = useDispatch()
Expand All @@ -16,6 +17,7 @@ const ContentDiscoveryAbout = () => {
<center>
<h3>About Content Discovery</h3>
</center>
<ContentDiscoveryListener />
<br />
<br />
<div>
Expand Down
13 changes: 12 additions & 1 deletion src/views/contentDiscovery/index.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,21 @@
import React from 'react'
import React, { useEffect } from 'react'
import { CCol, CNavLink, CRow, CWidgetStatsF } from '@coreui/react'
import ContentDiscoveryListener from '../../helpers/listeners/ContentDiscoveryListener'
import CIcon from '@coreui/icons-react'
import { cilFire } from '@coreui/icons'
import { useDispatch, useSelector } from 'react-redux'
import { createContentDiscoveryControlPanel } from '../../redux/features/grapevine/slice'

const ContentDiscoveryDashboard = () => {
const oGrapevineControlPanels = useSelector((state) => state.grapevine.controlPanels)
const dispatch = useDispatch()
useEffect(() => {
// update store if account was created and logged in prior to what will likely become the v0.3.0 update; only need to do this one time per user.
// May replace this with a more generalized review of the redux store to make sure it is up to date
if (!oGrapevineControlPanels.contentDiscovery) {
dispatch(createContentDiscoveryControlPanel())
}
}, []) // eslint-disable-line react-hooks/exhaustive-deps
return (
<>
<center>
Expand Down
2 changes: 2 additions & 0 deletions src/views/contentDiscovery/recommendations/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import React, { useState } from 'react'
import { useSelector } from 'react-redux'
import ContextSelector from './contextSelector'
import RecommendedProfiles from './tableOfProfiles'
import ContentDiscoveryListener from '../../../helpers/listeners/ContentDiscoveryListener'

const Recommendations = () => {
const [context, setContext] = useState('')
Expand All @@ -16,6 +17,7 @@ const Recommendations = () => {
<center>
<h3>Contextual Recommendation Lists</h3>
</center>
<ContentDiscoveryListener />
<br />
<div>
Select a context and see a list of recommended profiles. (Make sure to calculate Influence
Expand Down

0 comments on commit 641699f

Please sign in to comment.