@solidjs/router 0.10.6 → 0.10.7

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.
@@ -66,8 +66,8 @@ export function action(fn, name) {
66
66
  return p;
67
67
  }
68
68
  const url = fn.url ||
69
- (name && `action:${name}`) ||
70
- (!isServer ? `action:${hashString(fn.toString())}` : "");
69
+ (name && `https://action/${name}`) ||
70
+ (!isServer ? `https://action/${hashString(fn.toString())}` : "");
71
71
  return toAction(mutate, url);
72
72
  }
73
73
  function toAction(fn, url) {
@@ -82,7 +82,7 @@ function toAction(fn, url) {
82
82
  };
83
83
  const uri = new URL(url, "http://sar");
84
84
  uri.searchParams.set("args", hashKey(args));
85
- return toAction(newFn, (uri.protocol === "action:" ? uri.protocol : "") + uri.pathname + uri.search);
85
+ return toAction(newFn, (uri.origin === "https://action" ? uri.origin : "") + uri.pathname + uri.search);
86
86
  };
87
87
  fn.url = url;
88
88
  if (!isServer) {
@@ -124,7 +124,7 @@ export function cache(fn, name, options) {
124
124
  return;
125
125
  }
126
126
  if (error)
127
- throw error;
127
+ throw v;
128
128
  if (isServer)
129
129
  return v;
130
130
  setStore(key, reconcile(v, options));
@@ -87,7 +87,7 @@ export function setupNativeEvents(preload = true, explicitLinks = false, actionB
87
87
  : evt.target.action;
88
88
  if (!actionRef)
89
89
  return;
90
- if (!actionRef.startsWith("action:")) {
90
+ if (!actionRef.startsWith("https://action/")) {
91
91
  const url = new URL(actionRef);
92
92
  actionRef = router.parsePath(url.pathname + url.search);
93
93
  if (!actionRef.startsWith(actionBase))
@@ -99,6 +99,8 @@ export function setupNativeEvents(preload = true, explicitLinks = false, actionB
99
99
  if (handler) {
100
100
  evt.preventDefault();
101
101
  const data = new FormData(evt.target);
102
+ if (evt.submitter && evt.submitter.name)
103
+ data.append(evt.submitter.name, evt.submitter.value);
102
104
  handler.call(router, data);
103
105
  }
104
106
  }
package/dist/index.js CHANGED
@@ -878,7 +878,7 @@ function cache(fn, name, options) {
878
878
  }
879
879
  return;
880
880
  }
881
- if (error) throw error;
881
+ if (error) throw v;
882
882
  if (isServer) return v;
883
883
  setStore(key, reconcile(v, options));
884
884
  return store[key];
@@ -988,7 +988,7 @@ function action(fn, name) {
988
988
  p.then(handler, handler);
989
989
  return p;
990
990
  }
991
- const url = fn.url || name && `action:${name}` || (!isServer ? `action:${hashString(fn.toString())}` : "");
991
+ const url = fn.url || name && `https://action/${name}` || (!isServer ? `https://action/${hashString(fn.toString())}` : "");
992
992
  return toAction(mutate, url);
993
993
  }
994
994
  function toAction(fn, url) {
@@ -1002,7 +1002,7 @@ function toAction(fn, url) {
1002
1002
  };
1003
1003
  const uri = new URL(url, "http://sar");
1004
1004
  uri.searchParams.set("args", hashKey(args));
1005
- return toAction(newFn, (uri.protocol === "action:" ? uri.protocol : "") + uri.pathname + uri.search);
1005
+ return toAction(newFn, (uri.origin === "https://action" ? uri.origin : "") + uri.pathname + uri.search);
1006
1006
  };
1007
1007
  fn.url = url;
1008
1008
  if (!isServer) {
@@ -1098,7 +1098,7 @@ function setupNativeEvents(preload = true, explicitLinks = false, actionBase = "
1098
1098
  function handleFormSubmit(evt) {
1099
1099
  let actionRef = evt.submitter && evt.submitter.hasAttribute("formaction") ? evt.submitter.formAction : evt.target.action;
1100
1100
  if (!actionRef) return;
1101
- if (!actionRef.startsWith("action:")) {
1101
+ if (!actionRef.startsWith("https://action/")) {
1102
1102
  const url = new URL(actionRef);
1103
1103
  actionRef = router.parsePath(url.pathname + url.search);
1104
1104
  if (!actionRef.startsWith(actionBase)) return;
@@ -1108,6 +1108,7 @@ function setupNativeEvents(preload = true, explicitLinks = false, actionBase = "
1108
1108
  if (handler) {
1109
1109
  evt.preventDefault();
1110
1110
  const data = new FormData(evt.target);
1111
+ if (evt.submitter && evt.submitter.name) data.append(evt.submitter.name, evt.submitter.value);
1111
1112
  handler.call(router, data);
1112
1113
  }
1113
1114
  }
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "Ryan Turnquist"
7
7
  ],
8
8
  "license": "MIT",
9
- "version": "0.10.6",
9
+ "version": "0.10.7",
10
10
  "homepage": "https://github.com/solidjs/solid-router#readme",
11
11
  "repository": {
12
12
  "type": "git",