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

App bar with a primary search field not working #43882

Closed
LakshayRohilla opened this issue Sep 25, 2024 · 4 comments
Closed

App bar with a primary search field not working #43882

LakshayRohilla opened this issue Sep 25, 2024 · 4 comments
Assignees
Labels
component: app bar This is the name of the generic UI component, not the React module! status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it support: docs-feedback Feedback from documentation page

Comments

@LakshayRohilla
Copy link

LakshayRohilla commented Sep 25, 2024

Related page

https://mui.com/material-ui/react-app-bar/

Kind of issue

Other

Issue description

Usually copy pasting the component code from the docs into our personal project works,
However, I want to use App bar with a primary search field.

Its failing with the following error, at line 60:
Code, at line 60 :

const [anchorEl, setAnchorEl] = React.useState<null | HTMLElement>(null);

Output :

Uncaught TypeError: number 0 is not iterable (cannot read property Symbol(Symbol.iterator))
    at NavBar (navBar.jsx:60:1)
    at renderWithHooks (react-dom.development.js:15486:1)
    at mountIndeterminateComponent (react-dom.development.js:20103:1)
    at beginWork (react-dom.development.js:21626:1)
    at beginWork$1 (react-dom.development.js:27465:1)
    at performUnitOfWork (react-dom.development.js:26596:1)
    at workLoopSync (react-dom.development.js:26505:1)
    at renderRootSync (react-dom.development.js:26473:1)
    at recoverFromConcurrentError (react-dom.development.js:25889:1)
    at performConcurrentWorkOnRoot (react-dom.development.js:25789:1)

Context

No response

Search keywords: App bar with a primary search field

@LakshayRohilla LakshayRohilla added status: waiting for maintainer These issues haven't been looked at yet by a maintainer support: docs-feedback Feedback from documentation page labels Sep 25, 2024
@zannager zannager added the component: app bar This is the name of the generic UI component, not the React module! label Sep 25, 2024
@LakshayRohilla
Copy link
Author

Hi @siriwatknp,
For your support, I made a dummy project to get a better understanding of the error.
Project link : https://github.com/LakshayRohilla/mui-app-bar-issue-43882

Just clone it and run it using npm run start.
Here, I added 2 components Heading and Navbar(This is the one containing the App bar).

Hope this will come handy.

@sai6855
Copy link
Contributor

sai6855 commented Oct 3, 2024

@LakshayRohilla you are trying to use typescript syntax in .js files which is what causing the error

https://github.com/LakshayRohilla/mui-app-bar-issue-43882/blob/a473e90bf88f620733dc303ac5e31387c0789239/src/component/navbar.jsx#L60

@sai6855 sai6855 removed the status: waiting for maintainer These issues haven't been looked at yet by a maintainer label Oct 3, 2024
@sai6855 sai6855 closed this as completed Oct 3, 2024
Copy link

github-actions bot commented Oct 3, 2024

This issue has been closed. If you have a similar problem but not exactly the same, please open a new issue.
Now, if you have additional information related to this issue or things that could help future readers, feel free to leave a comment.

Note

We value your feedback @LakshayRohilla! How was your experience with our support team?
We'd love to hear your thoughts in this brief Support Satisfaction survey. Your insights help us improve!

@sai6855 sai6855 added the status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it label Oct 3, 2024
@LakshayRohilla
Copy link
Author

I changed the tsx code to jsx code earlier.
Still there was the same issue.

Though, today I noticed that 6.1.1 version is updated to 6.1.2.
Just by updating the mui version to 6.1.2 its working fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: app bar This is the name of the generic UI component, not the React module! status: expected behavior Does not imply the behavior is intended. Just that we know about it and can't work around it support: docs-feedback Feedback from documentation page
Projects
None yet
Development

No branches or pull requests

4 participants