Custom siteInfoMoreMenu stopped working after new update

In the latest version of Local (Version 8.3.1+6650) custom more menu item is not rendering or doing anything.

I have tried downgrading, works. Documentation has no changes ?

It has been working so far thru out all the updates

You can try it out with simple:

// Add a new route
	hooks.addContent('routes[site-info]', () => {
		return (
			<Route
				key="myRoute"
				path="/main/site-info/:siteID/myRoute"
				render={(props) => <div>My Route</div>}
			/>
		);
	});

// Add a new menu item that navigates to the new route
	hooks.addFilter('siteInfoMoreMenu', function (menu, site) {
		menu.push({
			label: 'Go to My Route',
			enabled: true,
			click: () => {
				context.events.send('goToRoute', `/main/site-info/${site.id}/myRoute`);
			},
		});

		return menu;
	});

Hi @dzoniis

Does it work again if you downgrade your Local version?

Did you even read the whole question?

I have tried downgrading, works. Documentation has no changes ?

It did work with previous version if local, downgrading works again

I have multiple sites on local, on none does it work
Every site is on: nginx, php@7.4/8.1, mysql both versions, tho tried with every possible viable combination, still not working

Tried boilerplater addon, MoreMenu doesn’t work at all, tools does

Nothing else changed exept for the local version, env etc is the same as it was

@Nick-B

1 Like

Apologies for missing your troubleshooting notes there @dzoniis!

I’ll attempt to replicate and share this with the team. I’ve seen one other user who has run into this on the latest version as well.

1 Like

Grazie, also is there a way to get proper up to date documentation for addon creation? @Nick-B

We don’t have anything available other than what you currently see. I know it’s not up to date but the team has been having conversations lately around our approach to add ons so that’s something that is still in flux. More to come there!

1 Like

Hey @dzoniis Thanks for letting us know about this regression and sorry about the out-of-date documentation for Addons.

Can you give us a little more info about the error you are seeing as well as what version of Local you downgraded to?

I’ll be honest in saying that it’s been a while since I’ve created a new addon from scratch and when I use the code you provide within a newly created addon using npx create-local-addon it doesn’t work. That being said, that same addon/code combination doesn’t work for any version of Local that I’ve tried going back to 7.2.

My gut tells me that there’s likely some breaking and/or deprecated package dependencies out there causing issues, especially as they relate to Typescript and React versions.

If you have the Addon that you’re using available, I’d love to take a peek and see if there is anything that stands out to me.

In the latest version of Local (Version 8.3.1+6650) my custom addon menu item no longer works. What changes have been done here?

In multiple years it has been working fine with this:

hooks.addFilter('siteInfoMoreMenu', (menu, site) => {
	menu.push(
		{
			label: 'Some label',
			enabled: true,
			click: () => {
				context.events.send(
					'goToRoute',
					`/main/site-info/${site.id}/some-slug`,
				);
			},
		},
	);

	return menu;
});

Have not tried downgrading yet, but to replicate, I think you can do:

export default function (context) {
	const { React, hooks } = context;
	const { Route } = context.ReactRouter;

	hooks.addContent('routes[site-info]', () => {
		return (
			<Route
				key="some-slug"
				path="/main/site-info/:siteID/some-slug"
				render={(props) => <h1>Simplest component</h1>}
				notifier={context.notifier}
			/>
		);
	});

	/**
	 * Adding new menu item for this plugin
	 */
	hooks.addFilter('siteInfoMoreMenu', (menu, site) => {
		menu.push(
			{
				label: 'Some label',
				enabled: true,
				click: () => {
					context.events.send(
						'goToRoute',
						`/main/site-info/${site.id}/some-slug`,
					);
				},
			},
		);

		return menu;
	});
}

In renderer.tsx

Hello @ben.turner,
I am currently using “Version 8.2.1+6583”, and it’s working fine as it should
Tho there is no error in the console or anywhere.
Just use simple renderer.tsx

export default function (context) {
	const { React, hooks } = context;
	const { Route } = context.ReactRouter;

	hooks.addContent('routes[site-info]', () => {
		return (
			<Route
				key="some-slug"
				path="/main/site-info/:siteID/some-slug"
				render={(props) => <h1>Simplest component</h1>}
				notifier={context.notifier}
			/>
		);
	});

	/**
	 * Adding new menu item for this plugin
	 */
	hooks.addFilter('siteInfoMoreMenu', (menu, site) => {
		menu.push(
			{
				label: 'Some label',
				enabled: true,
				click: () => {
					context.events.send(
						'goToRoute',
						`/main/site-info/${site.id}/some-slug`,
					);
				},
			},
		);

		return menu;
	});
}

That would suffice to verify if the filter for siteInfoMoreMenu is working or not.
On the latest version it’s defaulting back to Overview tab, tho the click event is triggered but i get no rendered content of the tab itself.
You could use boilerplate coming from the npx, just add this into renderer and it should work on previously mentioned downgraded version

i could provide you with zipped version of the basic addon using this code which is working as it should if that’s okay?

Thank you @dzoniis for the follow-up! @kimmenbert I merged the highlights from your thread into here as well since you were running into the same issue. Could you check out Ben’s comment above and provide any further context that might be helpful?

@ben.turner Any luck on figuring what’s going on ?

@dzoniis I don’t have a timeline yet, but a fix for this should appear in the next beta and main releases (might not be the upcoming 9.0.0, but likely the one after that). Thanks for your patience.

3 Likes

Thank you :slight_smile:

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.

A fix for this is expected in Local 9.0.1, currently available in beta.

We normally roll beta releases into production within a week or so.

1 Like