Skip to content

search-inside-dropdown is not available in Next.js #399

Closed Answered by sho-tanaka0210
sho-tanaka0210 asked this question in Q&A
Discussion options

You must be logged in to vote

The issue was resolved by using the following implementation.
The problem was that HSSelect.getInstance was returning null.

    if (selectElementById) {
      const loadPreline = async () => {
        const { HSSelect } = await import("preline/preline")
        let el = HSSelect.getInstance(`#${elemId}`) as InstanceType<typeof HSSelect>;
        if (!el) {
          el = new HSSelect(selectElementById);
        }
        el.on("change", (value: string) => {
          onChange(Number(value));
        })
      };

      loadPreline();
    }

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by sho-tanaka0210
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant