homarr icon indicating copy to clipboard operation
homarr copied to clipboard

Add service button issue (torrents module)

Open pacjo opened this issue 3 years ago • 4 comments

Environment

Docker

Version

0.10.0

Describe the problem

When torrents module is enabled, clicking on some parts of the "Add Service" button will open torrent module's settings instead of opening "add service" popup. The affected area is mostly center.

Additional info

Video:

https://user-images.githubusercontent.com/56438628/188941400-9fb4d867-c30d-4e0b-b30a-8b47dd70e0d7.mp4

Please tick the boxes

  • [X] You've read the docs
  • [X] You've checked for duplicate issues
  • [X] You've tried to debug yourself

pacjo avatar Sep 07 '22 17:09 pacjo

I can verify that I have this issue in 0.10 too. This was not introduced with the latest update from 0.9 and has probably been around in Homarr for quite some while.

manuel-rw avatar Sep 07 '22 17:09 manuel-rw

don't really know how it happens. What browser / os are you using ?

ajnart avatar Sep 07 '22 23:09 ajnart

don't really know how it happens. What browser / os are you using ?

Chrome on win10. I don't have this problem on Android (also chrome)

pacjo avatar Sep 08 '22 05:09 pacjo

So I've been trying to pin down the issue with this. I have a suspicion what the problem could be, but wasn't able to verify it yet.

My investigation

  • Usually, Menu or Popovers require some sort of anchor element, to determine their position.
  • The issue only seems to occur on the torrent module. There is not much special about this module.
  • The issue occurs only occasionally on specific screen sizes. I verified that I got the issue on both Chrome, Firefox and Edge. I have the most issues with it on my touch laptop?

My suspicion I think, that the problem lies within this line: https://github.com/ajnart/homarr/blob/master/src/modules/moduleWrapper.tsx#L207

Why? I think this line causes the issue, because it acts as the anchor for the dropdown position. Lowercase components in React are quite unusual. But perhaps this library is also doing some funky useMemo / state stuff, which breaks the <Menu.Target/>? We could try to wrap the <motion.div> in a <div /> to verify this theory.

Weirdly, it almost never happens on my high end desktop pc, so I wonder if it has to do something with the CPU / IO load.

manuel-rw avatar Sep 09 '22 21:09 manuel-rw

@pacjo sorry for the late reply. Do you still have this issue happening on latest ? I have still not been able to replicate it

ajnart avatar Oct 11 '22 01:10 ajnart

So I've been trying to pin down the issue with this. I have a suspicion what the problem could be, but wasn't able to verify it yet.

My investigation

* Usually, Menu or Popovers require some sort of anchor element, to determine their position.

* The issue only seems to occur on the torrent module. There is not much special about this module.

* The issue occurs only occasionally on specific screen sizes. I verified that I got the issue on both Chrome, Firefox and Edge. I have the most issues with it on my touch laptop?

My suspicion I think, that the problem lies within this line: https://github.com/ajnart/homarr/blob/master/src/modules/moduleWrapper.tsx#L207

Why? I think this line causes the issue, because it acts as the anchor for the dropdown position. Lowercase components in React are quite unusual. But perhaps this library is also doing some funky useMemo / state stuff, which breaks the <Menu.Target/>? We could try to wrap the <motion.div> in a <div /> to verify this theory.

Weirdly, it almost never happens on my high end desktop pc, so I wonder if it has to do something with the CPU / IO load.

Might be the Menu target. I'll investigate it. It might be due to the absolute positioning breaking on slow JS loads. No clue

ajnart avatar Oct 11 '22 01:10 ajnart

Latest didn't fix it.

pacjo avatar Oct 12 '22 18:10 pacjo

Okay, thanks for confirming

manuel-rw avatar Oct 12 '22 18:10 manuel-rw

Ok, so I figured it out. Solution was actually pretty simple. I'll push a branch very soon. @pacjo would you be able to test out on a test docker image, to confirm that it was fixed?

manuel-rw avatar Oct 15 '22 19:10 manuel-rw

Sure, just let me know, when you're ready.

pacjo avatar Oct 15 '22 19:10 pacjo

Can you test, if this fixes it? I forgot that GitHub Actions workflows do not work with forks, so you'll have to clone the project and run it manually. Is this okay for you?

manuel-rw avatar Oct 15 '22 21:10 manuel-rw

I've cloned the project and it seems to run, but I can't access it from another device (my pc, as I run in on headless server).

is it the intended behavior? I've never used yarn before.

logs:

kamil@kronos:~/homarr$ HOST=192.168.1.13 yarn start
ready - started server on 0.0.0.0:3000, url: http://localhost:3000
warn  - You have enabled experimental feature(s).
warn  - Experimental features are not covered by semver, and may cause unexpected or broken application behavior. Use them at your own risk.

kamil@kronos:~/homarr$

pacjo avatar Oct 16 '22 07:10 pacjo

Yes, those warnings are expected behavior and can be ignored. Would you be able to run it on the server where you normally run Homarr, if I build a docker image?

manuel-rw avatar Oct 16 '22 09:10 manuel-rw

Would you be able to run it on the server where you normally run Homarr, if I build a docker image?

Sure

pacjo avatar Oct 16 '22 09:10 pacjo

Done. Make sure that you pull this image: https://github.com/ajnart/homarr/pkgs/container/homarr/45925518?tag=test-absolute-position-torrents-menu

manuel-rw avatar Oct 16 '22 09:10 manuel-rw

That fixed it.

pacjo avatar Oct 16 '22 09:10 pacjo