lovelace-tab-redirect-card icon indicating copy to clipboard operation
lovelace-tab-redirect-card copied to clipboard

Cannot read properties of null (reading 'querySelectorAll') in 2025.5.0

Open rrooggiieerr opened this issue 7 months ago • 3 comments

I just updated to HA 2025.5.0 and now the redirect is not rendered and an error is shown instead:

Image

rrooggiieerr avatar May 07 '25 22:05 rrooggiieerr

Same here. The display shows Tabs is null.

Image

TrippleDelta avatar May 09 '25 10:05 TrippleDelta

I managed to fix the issue by doing these changes:

  • Edit 'www/community/lovelace-tab-redirect-card/tab-redirect-card.js' using Visual Studio Code/notepad.
  • Look for
let tabs = uiRoot.shadowRoot.querySelector('ha-tabs');
if(!tabs) {
	tabs = uiRoot.shadowRoot.querySelector('paper-tabs');
}
const tabList = tabs.querySelectorAll('paper-tab');
  • replace with:
let tabs = uiRoot.shadowRoot.querySelector('sl-tab-group');
const tabList = tabs.tabs;
  • update javascript version : settings > dashboards > '. . .' > resources : update the querystring hacstag to something else.

spemme avatar May 10 '25 16:05 spemme

No Luck here.

TrippleDelta avatar May 11 '25 15:05 TrippleDelta

I have the same problem since 2025.5

Image

`type: grid cards:

  • type: custom:tab-redirect-card redirect:
    • user: nspanel entity_id: light.spots entity_state: "on" redirect_to_tab_index: 0
    • user: nspanel entity_id: light.schemerlampen entity_state: "on" redirect_to_tab_index: 0`

rhannink avatar May 16 '25 07:05 rhannink

is this project still active? I do not see activities for years.

Pirol62 avatar May 26 '25 07:05 Pirol62

I tried the solution from spemme - no result. Still the same issue

Pirol62 avatar May 26 '25 08:05 Pirol62

@Pirol62 : Odd that it's working for me. It's crucial that the version of the resource is changed, otherwise Home assistant will never serve the new javascript.

spemme avatar May 26 '25 08:05 spemme

I did that. Changed to '/hacsfiles/lovelace-tab-redirect-card/tab-redirect-card.js?hacstag=55' and even restarted HA

Pirol62 avatar May 26 '25 09:05 Pirol62

Ok, I solved my issue with browser_mod.

Pirol62 avatar May 26 '25 09:05 Pirol62

I have changed mine to the following and it works.

	let tabs = uiRoot.shadowRoot.querySelector('sl-tab-group');
	if(!tabs) {
		tabs = uiRoot.shadowRoot.querySelector('paper-tabs');
	}
	const tabList = tabs.querySelectorAll('sl-tab');

tkhkbn avatar May 28 '25 02:05 tkhkbn

I did that. Changed to '/hacsfiles/lovelace-tab-redirect-card/tab-redirect-card.js?hacstag=55' and even restarted HA

What is 55? The same for any installation?

TrippleDelta avatar May 28 '25 08:05 TrippleDelta

Ok, I solved my issue with browser_mod.

Same here. I gave up. It's goodbye tab redirect.

TrippleDelta avatar May 30 '25 05:05 TrippleDelta

The solution posted by @spemme worked for me. Thanks!

TarheelGrad1998 avatar May 30 '25 19:05 TarheelGrad1998

I made this change in my fork. Feel free to install via HACS: https://github.com/evansalter/lovelace-tab-redirect-card

I've also opened a PR to this repo. @ben8p can you merge? https://github.com/ben8p/lovelace-tab-redirect-card/pull/14

evansalter avatar Jun 23 '25 18:06 evansalter