@shaper.org/vite-react-plugin 1.0.11 → 1.0.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/templates/main.ts +15 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaper.org/vite-react-plugin",
3
- "version": "1.0.11",
3
+ "version": "1.0.12",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "private": false,
package/templates/main.ts CHANGED
@@ -108,7 +108,7 @@ export class ReactRouteMonitor {
108
108
  this.iframeClient.onMessage((event) => {
109
109
  const messageData = event.data;
110
110
  if (messageData.type == "push-route") {
111
- window.location.href = messageData.message.path;
111
+ history.pushState({}, "", messageData.message.path);
112
112
  }
113
113
  });
114
114
  }
@@ -245,3 +245,17 @@ const monitor = new ReactRouteMonitor({
245
245
 
246
246
  monitor.start();
247
247
  monitor.triggerRoutes();
248
+
249
+ // // simulate parent message
250
+ // setTimeout(() => {
251
+ // console.log("Simulating parent message");
252
+ // window.dispatchEvent(
253
+ // new MessageEvent("message", {
254
+ // data: {
255
+ // type: "push-route",
256
+ // message: { path: "/test" },
257
+ // },
258
+ // origin: "http://localhost:5173",
259
+ // }),
260
+ // );
261
+ // }, 1000);