Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions src/pages/Topic/Topic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ export const Topic = ({ useTopic = _useTopic }: TopicProps): JSX.Element => {
const setLearningPathElementSpecificStatus = usePersistedStore((state) => state.setLearningPathElementStatus)

const learningPathElementCache = useStore((state) => state._cache_learningPathElement_record)
const clearLearningPathElementCache = useStore((state) => state.clearLearningPathElementCache)
const learningPathLearningElementStatusCache = usePersistedStore((state) => state._learningPathElementStatus)

const { url, title, lmsId, isOpen, handleClose, mapNodes } = useTopic()
Expand Down Expand Up @@ -95,10 +96,6 @@ export const Topic = ({ useTopic = _useTopic }: TopicProps): JSX.Element => {
})
}

// Effect to handle the fitting of the view when the topic changes with the LocalNav
// [handleCustomFitView] as dependency because inside of it the fitViewButton changes,
// that way the reactFlow background is changed before rendering it in a old position from the prev. topic

// Get status of every learning element for user by request to backend
// then get every learning element for topic by request to backend
// Map to nodes and edges and set them as initial nodes and edges
Expand Down Expand Up @@ -155,6 +152,11 @@ export const Topic = ({ useTopic = _useTopic }: TopicProps): JSX.Element => {
}
}, [initialNodes, navigate, hasCentered])

//trigger refetch of learning path when user navigates away from topic page
useEffect(() => {
clearLearningPathElementCache()
}, [navigate])

/**
* Update the learning path element status for the user after he closes a learning Element (iframe)
* @param user
Expand Down
Loading