cms
cms copied to clipboard
bug: the sidebar re renders when switching between videos
https://github.com/code100x/cms/assets/98402835/7bace462-37f1-4daf-beb2-d439ad8501ce
🙋 @hkirat
@aakash2330 if u want u can work on the issue, its simple just move the sidebar component with the get api call to the layout.js file into courseId folder
I need a little guidance, I added Sidebar in layout.tsx under [...courseId] > layout.tsx,
I am getting this error
This error coming under Sidebar.tsx
⨯ src\components\Sidebar.tsx (67:20) @ map
⨯ TypeError: Cannot read properties of undefined (reading 'map')
at renderContent (./src/components/Sidebar.tsx:64:25)
at Sidebar (./src/components/Sidebar.tsx:204:27)
65 |
66 | const renderContent = (contents: any) => {
67 | return contents.map((content: any) => { | ^ 68 | if (content.children && content.children.length > 0) { 69 | // This is a folder with children 70 | return ( ⨯ src\components\Sidebar.tsx (67:20) @ map ⨯ TypeError: Cannot read properties of undefined (reading 'map') at renderContent (./src/components/Sidebar.tsx:64:25) at Sidebar (./src/components/Sidebar.tsx:204:27) 65 | 66 | const renderContent = (contents: any) => { 67 | return contents.map((content: any) => { | ^ 68 | if (content.children && content.children.length > 0) { 69 | // This is a folder with children 70 | return (
I can't find help on this will need how I can tackle
@aakash-a-dev the session is still in loading phase while the sidebar is being rendered, the response from the server will give unauthorized access, so the contents would be undefined, i guess
I figured out that layout.tsx doesn't allow data fetching directly so going through documentation probable it can help me out
hey just checked the code out, its not that simple as thought, i might also be working on it, feel free to give a shot
I Think I'll try it out
https://github.com/code100x/cms/pull/349
@aakash2330 this PR does not fix the issue, it will still rerender, the issue i was talking about, is that when a user switches between different videos the sidebar should be fixed and the loader should only come at the place where the video is
hey just checked the code out, its not that simple as thought, i might also be working on it, feel free to give a shot
I am quite close to the solution just have to call the APIs in the layout I am stuck there, is it possible to work together on this?
@aakash-a-dev I'm done just creating the PR, you can take a look at it.
@aakash-a-dev I'm done just creating the PR, you can take a look at it.
Okayyy