Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: (section-list): Allow user to drag and drop to sort the sections in the sidebar #231

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

ngmgit
Copy link

@ngmgit ngmgit commented Feb 7, 2024

No description provided.

@ngmgit ngmgit marked this pull request as draft February 7, 2024 14:03
@ngmgit ngmgit marked this pull request as ready for review February 7, 2024 18:44
Copy link
Collaborator

@ducaale ducaale left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good

import Link from 'next/link'
import { useRouter } from 'next/router'
import styled from 'styled-components'
import { MdDragIndicator } from 'react-icons/md'
import arrayMove from 'array-move'
import SortableList, { SortableItem, SortableKnob } from 'react-easy-sort'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To avoid the following warning, shall we load SortableList dynamically with ssr disabled?

Warning: useLayoutEffect does nothing on the server, because its effect cannot be encoded into the server renderer's output format. This will lead to a mismatch between the initial, non-hydrated UI and the intended UI. To avoid this, useLayoutEffect should only be used in components that render exclusively on the client. See https://reactjs.org/link/uselayouteffect-ssr for common fixes.
    at SortableList (/home/ducaale/resumake.io/node_modules/react-easy-sort/index.js:375:21)

Something like this should do the trick

const SortableList = dynamic(
  async () => await import('react-easy-sort'),
  { ssr: false }
)

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure, I havent got time to checkout nextjs related things yet. So its your call.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants