question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Layout] Properties are Not Passed when using "as" (1.0.0-next.6)

See original GitHub issue

~When working with a component that used an object as a prop I noticed that it would not come through when using an “as” property.~

When using non HTML property names properties are not passed when using “as”. For example name and href props will pass but anything that doesn’t have an HTML prop on an element does not (that is my working theory anyway).

Quite simply

     <SimpleComponent name="Susan" nested={{ lastName: "Smith" }}>Children Work</SimpleComponent>

Will pass nested to the component but

      <Box as={SimpleComponent} name="Susan" nested={{ lastName: "Smith" }}> Children Still Work</Box>

Will not pass the nested property to simple component (name property will pass). I tried this with a few other components as well (Button, Flex) with same behavior.

Expected Behavior I expect as to pass props to the base component of any type

Link to minimal reproduction https://codesandbox.io/s/relaxed-vaughan-xjglk?file=/src/App.tsx

Steps to Reproduce See sandbox

Suggested solution(s)

I have not looked closely but I think this would be a candidate for a unit test. If you agree it is a bug I’m happy to help create that.

Desktop (please complete the following information):

  • OS: MacOS
  • Browser: Chrome, Safari
  • Version 84, 13.1.1

Additional context I love Chakra-UI, nice work! 😃

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
with-heartcommented, Jul 28, 2020

I’ve been looking into this and I think I’ve figured out what’s wrong. Looks like the way we determine whether props should be forwarded in our shouldForwardProp function changed recently, and it doesn’t apply to non-HTML+non-system props the way it should.

1reaction
with-heartcommented, Jul 24, 2020

You’re right! That was a mistake on my part

Read more comments on GitHub >

github_iconTop Results From Across the Web

kit/CHANGELOG.md at master · sveltejs/kit · GitHub
1.0.0-next.583. Patch Changes. restart vite dev-server on svelte config change (#8087). Set correct $page.status when using enhance and result is of type ...
Read more >
c# - ASP.NET MVC 3 - Custom WebViewPage can't set Layout ...
I've tried adding an additional Layout override to the class, using base.Layout, etc. The base class shows that Layout is simply a property,...
Read more >
How to pass parameters to a view component
When invoking from a view in ASP.NET Core 1.0.0 or from a controller, you can use an anonymous method to pass parameters, where...
Read more >
To Override Layer Properties in Layout Viewports | AutoCAD ...
When VISRETAIN is set to 0 when the drawing is opened in a previous release, viewport overrides in xref layers are not retained....
Read more >
Static Route Preferences and Qualified Next Hops | Junos OS
When you do not set a preferred route, the Junos OS chooses in a random fashion ... Qualified next hops allow you to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found