flow icon indicating copy to clipboard operation
flow copied to clipboard

get query parameters at any point

Open avdhootu27 opened this issue 10 months ago • 4 comments

Describe your motivation

Currently there is no API which can return query parameters of current page url, or there is also not any API which returns current url path. There is a way to get query parameters but it needs event (e.g. beforeEvent), but there is no any method for which event is not required.

Describe the solution you'd like

Provide an API which returns at least query parameters, or whole url path. In vaadin 14

avdhootu27 avatar Mar 28 '24 09:03 avdhootu27

Couldn't you use UI.getActiveViewLocation()?

mcollovati avatar Mar 28 '24 17:03 mcollovati

I am on Vaadin 14 and there is no getActiveViewLocation method in UI

avdhootu27 avatar Apr 01 '24 05:04 avdhootu27

Yeah, this API wasn't picked to Vaadin 14 from Vaadin 24, but you can try UI.getInternals().getActiveViewLocation().getQueryParameters(), which should be already in Vaadin 14 for years.

mshabarov avatar Apr 02 '24 10:04 mshabarov

I tried it but, it doesn't work properly, mostly it worked first time but later when I switched between views it didn't work.

avdhootu27 avatar Apr 02 '24 11:04 avdhootu27