Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Nested react contexts doesn't work right on client component #319

Open
Assignees
pedrobslisboa
Labels
bugSomething isn't working
@pedrobslisboa

Description

@pedrobslisboa

At thisPR@davesnx commented the nested_context test, which is a test to ensure we don't make mistake when using the same react context nested:

let context=React.createContextReact.nullinletprovider~value~children=React.Upper_case_component      ("provider",fun() ->React.Client_component            {              import_module="./provider.js";              import_name="Provider";              props= [ ("value",React.Element value); ("children",React.Element children) ];              client=React.Context.provider context~value~children();            } )inlet client=React.Upper_case_component      ("client",fun() ->let context=React.useContext contextin          context )inletconsumer()=React.Client_component { import_module="./consumer.js"; import_name="Consumer"; props=[]; client }inletcontent()=React.Upper_case_component ("content",fun() -> provider~value:React.null~children:(React.string"Hey you"))inletme()=React.Upper_case_component      ("me",fun() -> provider~value:(content())~children:(React.array [|React.string"/me"; consumer() |]))inletabout()=React.Upper_case_component      ("about",fun() -> provider~value:(me())~children:(React.array [|React.string"/about"; consumer() |]))inletapp()=React.Upper_case_component      ("root",fun() -> provider~value:(about())~children:(React.array [|React.string"/root"; consumer() |]))
  • Current shell result:
"/root<script data-payload='0:[\"$\",\"$12\",null,{\"value\":\"$f\",\"children\":\"$11\"},null,[],{}]\n'>window.srr_stream.push()</script>
  • What it should be:
  "/root<!-- -->/about<!-- -->/me<!-- -->Hey you<script \    data-payload='0:[\"$\",\"$a\",null,{\"value\":\"$1\",\"children\":[\"/root\",[\"$\",\"$9\",null,{}]]}]\n\    '>window.srr_stream.push()</script>"

In a previous attempt to solve this issue I made theclient property ofReact.Client_component as a function to lazy call it on runtime avoiding any issues with context value scope.

I'm looking for a way to solve it without getting back to client as function, but I'm opening this issue to register the bug.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp