algolia / algolia/instantsearch

[react-instantsearch-nextjs] Duplicate server state script tag in initial DOM

Open
#6,905 5 comments 0 reactions 0 assignees View on GitHub
triage
Dominant language
TypeScript
Stars
4.1k
Forks
553
Avg merge
1d 11h
Merged PRs (30d)
51

Description

### 🐛 Current behavior

We are using `react-instantsearch-nextjs` in our project.

We having two instances of `` accros our projects (for the result page items and the search box itself). This lead to two script tags with the server state. As the correct one comes afterwards, the value is correctly applied.

Image

### 🔍 Steps to reproduce

Having two instances of `` in the project

### Live reproduction

example.com

### 💭 Expected behavior

- only one server state script tag

### Package version

"react-instantsearch": "7.24.0", "react-instantsearch-nextjs": "1.0.15",

### Operating system

macOS

### Browser

Chrome

### Code of Conduct

- [x] I agree to follow this project's Code of Conduct

Contributor guide

Open the contributing guide

Research direction

Start by reproducing the issue with two instances of in a react-instantsearch-nextjs application, then trace where each instance emits the server-state script tag. Done means the initial DOM contains only one server-state script tag and the relevant behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
next.js, react, typescript
Domain
frontend, search
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.