@typed/router 0.4.1 → 0.5.1

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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@typed/router",
3
- "version": "0.4.1",
3
+ "version": "0.5.1",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -19,16 +19,16 @@
19
19
  }
20
20
  },
21
21
  "dependencies": {
22
- "@effect/data": "^0.7.4",
23
- "@effect/io": "^0.15.1",
24
- "@typed/context": "0.4.1",
25
- "@typed/dom": "8.4.1",
26
- "@typed/fx": "1.4.1",
27
- "@typed/html": "3.4.1",
22
+ "@effect/data": "^0.10.3",
23
+ "@effect/io": "^0.17.0",
24
+ "@typed/context": "0.5.1",
25
+ "@typed/dom": "8.5.1",
26
+ "@typed/fx": "1.5.1",
27
+ "@typed/html": "3.5.1",
28
28
  "@typed/path": "0.1.0",
29
- "@typed/route": "0.3.0"
29
+ "@typed/route": "0.4.0"
30
30
  },
31
- "gitHead": "045d1a1cbd6ebed153f24f946b14fd2c638fdb4c",
31
+ "gitHead": "eb7de6339939cb3cad08520f2b1d179d333d10ca",
32
32
  "publishConfig": {
33
33
  "access": "public"
34
34
  },
@@ -112,6 +112,7 @@ export function RouteMatcher<R, E>(routes: RouteMatcher<R, E>['routes']): RouteM
112
112
  ) =>
113
113
  Router.withFx((router) =>
114
114
  Fx.gen(function* ($) {
115
+ const { outlet } = yield* $(Router)
115
116
  const { environment } = yield* $(RenderContext)
116
117
  // Create stable references to the route matchers
117
118
  const matchers = Array.from(routes.values()).map(
@@ -138,13 +139,11 @@ export function RouteMatcher<R, E>(routes: RouteMatcher<R, E>['routes']): RouteM
138
139
  layout?: Fx.Fx<any, any, html.Renderable>,
139
140
  ): Effect.Effect<any, any, Option.Option<Fx.Fx<any, any, html.Renderable>>> =>
140
141
  Effect.gen(function* ($) {
141
- const { outlet } = yield* $(Router)
142
142
  const previous = samplePreviousValues()
143
143
 
144
144
  // Update the previous values
145
145
  previousRender = render
146
146
  previousLayout = layout
147
- previousFiber = undefined
148
147
 
149
148
  // Skip rerendering if the render function is the same
150
149
  if (previous.render === render && previous.layout === layout) {
@@ -154,6 +153,7 @@ export function RouteMatcher<R, E>(routes: RouteMatcher<R, E>['routes']): RouteM
154
153
  // Interrupt the previous fiber if it exists
155
154
  if (previous.render !== render && previous.fiber) {
156
155
  yield* $(Fiber.interrupt(previous.fiber))
156
+ previousFiber = undefined
157
157
  }
158
158
 
159
159
  // If we have a layout, we need to render it and use the route outlet.
@@ -166,10 +166,10 @@ export function RouteMatcher<R, E>(routes: RouteMatcher<R, E>['routes']): RouteM
166
166
  Fx.observe(outlet.set),
167
167
  Effect.onError((cause) =>
168
168
  Cause.isInterruptedOnly(cause)
169
- ? Effect.unit()
169
+ ? outlet.set(null)
170
170
  : outlet.error(cause as Cause.Cause<never>),
171
171
  ),
172
- Effect.forkScoped,
172
+ Effect.forkDaemon,
173
173
  ),
174
174
  )
175
175
  }