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(react-instantsearch-ssr-nextjs): turn Next.js RSC/SSR solution into its own package #5830

Conversation

sarahdayan
Copy link
Member

@sarahdayan sarahdayan commented Aug 31, 2023

This PR builds upon Aymeric's work and extracts the wrapper in its own package, to leave the minimal amount of code in react-instantsearch-core.

Some notes that will probably need to be adressed during real implementation:

  • Routing will work by relying on the usual historyRouter() and conditionally returning a composited URL using Next.js Hooks. It might be interesting to provide a friendlier interface for building this URL
  • Bumped node to 16.12, but we might want to see if we can reliably bump it further (latest 16, maybe 18?)
  • other next examples have been bumped to latest next.js version in order to have a single dependency version in our monorepo, but now these examples don't run correctly, we probably will need to take time to investigate and fix those (or revert to next 12 for them)
  • probably a tooling issue that can be fixed, but the cjs module test fails for the new package

@sarahdayan sarahdayan force-pushed the feat/experimental-rsc-and-next-app-dir-support-package branch from f779bd2 to 1dcd81c Compare August 31, 2023 13:47
@codesandbox-ci
Copy link

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit f779bd2:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-default-theme Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-vue-instantsearch-default-theme Configuration

@codesandbox-ci
Copy link

codesandbox-ci bot commented Aug 31, 2023

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit d5de2eb:

Sandbox Source
InstantSearch.js Configuration
react-instantsearch-app Configuration
example-react-instantsearch-next-app-dir-example Configuration
example-vue-instantsearch-default-theme Configuration

@sarahdayan sarahdayan force-pushed the feat/experimental-rsc-and-next-app-dir-support-package branch from 1eee332 to 2642653 Compare August 31, 2023 14:05
Comment on lines +18 to +19
"react-instantsearch-router-nextjs": "7.0.1",
"react-instantsearch-ssr-nextjs": "7.0.1"
Copy link
Contributor

Choose a reason for hiding this comment

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

do you think we could have instead one package react-instantsearch-nextjs that has both?

Copy link
Member

Choose a reason for hiding this comment

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

The router only works for pages while the other only works for app though 😅

Copy link
Member

Choose a reason for hiding this comment

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

As long as it's experimental I'd keep it as a separate package. But I dig the idea of having a single package for nextjs specific things in the future.

@sarahdayan sarahdayan force-pushed the feat/experimental-rsc-and-next-app-dir-support-package branch from e32d4b6 to 594d759 Compare August 31, 2023 14:21
@aymeric-giraudet aymeric-giraudet force-pushed the feat/experimental-rsc-and-next-app-dir-support-package branch from 664bc7d to 2fbad76 Compare September 4, 2023 08:30
@aymeric-giraudet aymeric-giraudet marked this pull request as ready for review September 7, 2023 13:53
@aymeric-giraudet aymeric-giraudet merged commit 2a74838 into feat/experimental-rsc-and-next-app-dir-support Sep 7, 2023
@aymeric-giraudet aymeric-giraudet deleted the feat/experimental-rsc-and-next-app-dir-support-package branch September 7, 2023 13:53
aymeric-giraudet added a commit that referenced this pull request Sep 19, 2023
…d Next.js app directory (#5827)

* feat(rsc): very experimental working PoC for Next.js app dir

* feat(`react-instantsearch-ssr-nextjs`): turn Next.js RSC/SSR solution into its own package (#5830)

* chore: create `react-instantsearch-ssr-nextjs` package

* chore: move Next.js RSC/SSR utilities to dedicated package

* docs: update Next App Router example with new package

* refactor: split context and usage Hook

* feat: pass `ServerInsertedHTMLContext` ourselves

* refactor: clean up importqs

* style: lint

* docs: build example in CodeSandbox

* ci: use Next.js 13 compatible Node version

* ci: use compatible Node version

* test: add version test files

* upgrade next version in all examples

* chore: remove unnecessary exports

* chore: remove weirdo character

* build: resolve Next for ESM

* refactor: move as much logic in new package as possible + dynamicWidgets support

* routing

---------

Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
Co-authored-by: Aymeric Giraudet <aymeric.giraudet@algolia.com>

* fix other next examples

* update deps in new package

* fix build/tests?

* bundlesize

* React import in app-dir example

* feat(RSC): add warnings (#5840)

* bump node version a bit

* avoid double results injection

* fix: routing when going from one InstantSearch page to another

Co-authored-by: Burak Tamtürk <buraktamturk@gmail.com>

* fix tests

* changed naming

* fix build

* forgot to rename dir

* fix multi index

* revert to renderToString

* remove doctoc line

* readme

* changed use

* update peerDep

* Apply suggestions from code review

Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>

---------

Co-authored-by: Sarah Dayan <5370675+sarahdayan@users.noreply.github.com>
Co-authored-by: Dhaya <154633+dhayab@users.noreply.github.com>
Co-authored-by: Burak Tamtürk <buraktamturk@gmail.com>
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.

4 participants