diff --git a/src/ui/src/components/core/root/CoreRoot.vue b/src/ui/src/components/core/root/CoreRoot.vue index 1fb4c2cb7..e9eaee9dc 100644 --- a/src/ui/src/components/core/root/CoreRoot.vue +++ b/src/ui/src/components/core/root/CoreRoot.vue @@ -18,15 +18,14 @@ import { useEvaluator } from "@/renderer/useEvaluator"; const ssHashChangeStub = ` def handle_hashchange(state, payload): # The payload is a dictionary with the page key and all the route variables in the URL hash. - # For example, if the current URL is - # http://localhost:3000/#main/animal=duck&colour=yellow + # For example, if the current URL is http://localhost:3000/#main/animal=duck&colour=yellow # you will get the following dictionary # { - # "page_key": "main", - # "route_vars": { - # "animal": "duck", - # "colour": "yellow" - # } + # "page_key": "main", + # "route_vars": { + # "animal": "duck", + # "colour": "yellow" + # } # } page_key = payload.get("page_key") @@ -40,6 +39,23 @@ def handle_hashchange(state, payload): else: state["message"] = "You're not in the Duck zone.`.trim(); +const wfAppOpenStub = ` +def handle_app_open(state): + # The payload is a dictionary with the page key and all the route variables in the URL hash. + # For example, if the current URL is http://localhost:3000/#/animal=duck&colour=yellow + # you will get the following dictionary + # { + # "page_key": "main", + # "route_vars": { + # "animal": "duck", + # "colour": "yellow" + # } + # } + + page_key = payload.get("page_key") + route_vars = payload.get("route_vars") +`.trim(); + const description = "The root component of the application, which serves as the starting point of the component hierarchy."; @@ -58,6 +74,10 @@ export default { ...sharedStyleFields, }, events: { + "wf-app-open": { + desc: "Captures the first application load, capture the page key and route vars.", + stub: wfAppOpenStub, + }, "wf-hashchange": { desc: "Capture changes to the URL hash, including page key and route vars.", stub: ssHashChangeStub, @@ -67,7 +87,15 @@ export default { };