Skip to content

Commit

Permalink
fixed friend filter hjs issues
Browse files Browse the repository at this point in the history
  • Loading branch information
sleeptil3 committed Sep 26, 2021
1 parent 9f05a12 commit 1a12d30
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/Pages/User/LockrRoom/View.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
import { useContext, useState, useEffect } from 'react'
import { useContext, useState, useEffect, useLayoutEffect } from 'react'
import { useHistory } from 'react-router-dom'
import Snippet from '../../../Components/Snippet'
import { getFriendSnippets } from '../../../API/apiData'
import { UserContext } from '../User'
import { DataContext } from '../../../App'
import hljs from 'highlight.js';

export default function View({ friendFilter, setFriendFilter }) {
const { userData, friendsList } = useContext(UserContext)
Expand Down Expand Up @@ -37,6 +38,10 @@ export default function View({ friendFilter, setFriendFilter }) {
setFriendFilter('')
}, [ setFriendFilter, history ])

useLayoutEffect(() => {
hljs.highlightAll()
}, [ friendSnippetData, friendFilter, search ])

return (
<div className="mt-4 sm:mt-0 sm:ml-2">
{ userData.friends.length ? <><h1 className="ml-6 sm:ml-0 text-lg sm:text-2xl font-bold">{ friendFilter ? `${ userData.friends.find(friend => friend._id === friendFilter).firstName } 's Shared Snippets` : "All Shared Snippets" }</h1>
Expand Down

0 comments on commit 1a12d30

Please sign in to comment.