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): separate entry point for RSC #1743

Merged
merged 1 commit into from
Aug 18, 2023

Conversation

timofei-iatsenko
Copy link
Collaborator

Description

Implementation step for: #1698

It turned out that RSC implementation in Nextjs complains when it meets any creacteContext function call in module import graph. So having a separate component which is not using context is not enough. It should be two completely separated entry points (files) and server entry point should not be polluted with createContext calls otherwise it shows an error:

createContext only works in Client Components. Add the "use client" directive at the top of the file to use it.

This PR brings additional entrypoint:

import { TransNoContext } from '@lingui/react/server';

Which is not intended to be used directly by end-users, but as part of future nextjs integration.

Types of changes

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update

Fixes # (issue)

Checklist

  • I have read the CONTRIBUTING and CODE_OF_CONDUCT docs
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)

@vercel
Copy link

vercel bot commented Aug 15, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
js-lingui ✅ Ready (Inspect) Visit Preview 💬 Add feedback Aug 15, 2023 10:24am

@timofei-iatsenko timofei-iatsenko changed the title feature(react): separate entry point for RSC feat(react): separate entry point for RSC Aug 15, 2023
@github-actions
Copy link

size-limit report 📦

Path Size
./packages/core/dist/index.mjs 2.76 KB (0%)
./packages/detect-locale/dist/index.mjs 721 B (0%)
./packages/react/dist/index.mjs 1.66 KB (0%)
./packages/remote-loader/dist/index.mjs 7.24 KB (0%)

@codecov
Copy link

codecov bot commented Aug 15, 2023

Codecov Report

Patch coverage: 90.32% and no project coverage change.

Comparison is base (4af4448) 75.95% compared to head (223f44a) 75.95%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1743   +/-   ##
=======================================
  Coverage   75.95%   75.95%           
=======================================
  Files          80       81    +1     
  Lines        2063     2063           
  Branches      529      529           
=======================================
  Hits         1567     1567           
  Misses        383      383           
  Partials      113      113           
Files Changed Coverage Δ
packages/react/src/I18nProvider.tsx 91.30% <ø> (ø)
packages/react/src/Trans.tsx 100.00% <ø> (+9.09%) ⬆️
packages/react/src/TransNoContext.tsx 90.32% <90.32%> (ø)

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@vonovak vonovak 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 to me!

Copy link
Contributor

@andrii-bodnar andrii-bodnar left a comment

Choose a reason for hiding this comment

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

@thekip thank you!

@andrii-bodnar andrii-bodnar merged commit 8232e13 into lingui:main Aug 18, 2023
@timofei-iatsenko timofei-iatsenko deleted the feature/rsc branch August 18, 2023 08:54
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.

3 participants