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

When there are more than one Search or Darkmode components, only the first ones function properly #1522

Open
keonly opened this issue Oct 16, 2024 · 7 comments
Labels
bug Something isn't working

Comments

@keonly
Copy link

keonly commented Oct 16, 2024

Describe the bug
When using Component.DesktopOnly on Component.Search or Component.Darkmode to the right, the components appear on the site but they do not function. (There may be other components that does not function as well, but I have not yet checked)

Adding these to the left functions normally.

When Component.Search or Component.Darkmode are used more than once, only the first ones functions normally. From the second one they do not function, despite being shown on the site.

To Reproduce
Steps to reproduce the behavior:

  1. Add the components in quartz.layout.ts.
  left: [
    Component.Search(),
    Component.Search(),
    Component.Darkmode(),
    Component.Darkmode(),
  ]
  1. Two search boxes and two darkmode toggles are shown on the site. However, only the first ones function normally.

Expected behavior
When clicking search or darkmode components, they should show a search bar and change theme respectively.

Screenshots and Source
If applicable, add screenshots to help explain your problem.

You can help speed up fixing the problem by either

  1. providing a simple reproduction
  2. linking to your Quartz repository where the problem can be observed

Desktop (please complete the following information):

  • Quartz Version: Latest commit (b3a0290)
  • node Version: v22.9.0
  • npm version: v10.9.0
  • OS: Linux
  • Browser: Firefox

Additional context
Add any other context about the problem here.

@keonly keonly added the bug Something isn't working label Oct 16, 2024
@saberzero1
Copy link
Collaborator

Hey, when you were testing this, were the component included multiple times (on both left sidebar and right sidebar) or just once?

@keonly
Copy link
Author

keonly commented Oct 17, 2024

Hey, when you were testing this, were the component included multiple times (on both left sidebar and right sidebar) or just once?

Ah yes, they were used in left with MobileOnly. It seems like multiple usages of Search / Darkmode components are causing errors.

@keonly keonly changed the title Search and Darkmode components created with DesktopOnly to the right does not function When there are more than one Search and Darkmode components, only the first ones function properly Oct 17, 2024
@keonly keonly changed the title When there are more than one Search and Darkmode components, only the first ones function properly When there are more than one Search or Darkmode components, only the first ones function properly Oct 17, 2024
@keonly
Copy link
Author

keonly commented Oct 17, 2024

I updated the issue title the bug description. Thank you for pointing out.

@saberzero1
Copy link
Collaborator

I updated the issue title the bug description. Thank you for pointing out.

Thanks. I suspected as much.

We'll need to update the selectors from single select to a multi select. Currently it expects a singular id and it finds multiple, thus resulting in the broken behavior.

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 17, 2024

This is currently a limitation, given that each components are considered a singleton.

@saberzero1
Copy link
Collaborator

This is currently a limitation, given that each components are considered a singleton.

I remember this being mentioned before. Is this something we want to add to the documentation? Currently searching singleton yields no results.

@aarnphm
Copy link
Collaborator

aarnphm commented Oct 18, 2024

No need to document this.

Repository owner deleted a comment Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants