westwoods LinkButton
is designed to handle an href
. If the href is a path to a Flarum page (without domain, like /settings
), navigation will be performed inside of the single page app. If it's an external link, the page will navigate to the new url, this might be what you experience as a refresh. Or maybe adding an onclick
handler overrides the default behavior, causing the link to work like a plain HTML link.
If you want a button with an onclick
handler, I suggest you use a Button
instead. That way it won't trigger the navigation javascript when clicked.
You could also check whether your button
has a type=button
attribute. If it doesn't have it, clicking the button will submit a form as a POST request, causing a page refresh. https://html.com/attributes/button-type/ Normally buttons created through Flarum's components should have type=button
added automatically.