@shaper.org/vite-react-plugin 1.0.13 → 1.0.14

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 +1 -31
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shaper.org/vite-react-plugin",
3
- "version": "1.0.13",
3
+ "version": "1.0.14",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "private": false,
package/templates/main.ts CHANGED
@@ -104,17 +104,6 @@ export class ReactRouteMonitor {
104
104
 
105
105
  this.sendAllRoutes = this.sendAllRoutes.bind(this);
106
106
  window.addEventListener("getroutes", this.sendAllRoutes);
107
-
108
- this.iframeClient.onMessage((event) => {
109
- const messageData = event.data;
110
- if (messageData.type == "push-route") {
111
- history.pushState(
112
- { type: "from-iframe-parent" },
113
- "",
114
- messageData.message.path,
115
- );
116
- }
117
- });
118
107
  }
119
108
 
120
109
  stop() {
@@ -133,13 +122,8 @@ export class ReactRouteMonitor {
133
122
 
134
123
  patchHistory() {
135
124
  history.pushState = (...args) => {
136
- let shouldTrigger = true;
137
- if (args[0] && args[0].type === "from-iframe-parent") {
138
- args[0] = {};
139
- shouldTrigger = false;
140
- }
141
125
  this.origPush.apply(history, args);
142
- if (shouldTrigger) this.triggerRouteChange();
126
+ this.triggerRouteChange();
143
127
  };
144
128
 
145
129
  history.replaceState = (...args) => {
@@ -254,17 +238,3 @@ const monitor = new ReactRouteMonitor({
254
238
 
255
239
  monitor.start();
256
240
  monitor.triggerRoutes();
257
-
258
- // // simulate parent message
259
- // setTimeout(() => {
260
- // console.log("Simulating parent message");
261
- // window.dispatchEvent(
262
- // new MessageEvent("message", {
263
- // data: {
264
- // type: "push-route",
265
- // message: { path: "/test" },
266
- // },
267
- // origin: "http://localhost:5173",
268
- // }),
269
- // );
270
- // }, 1000);