@ops-ai/react-router-toggly 1.2.0 → 1.2.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/CHANGELOG.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # Changelog
2
2
 
3
+ ## [1.2.1] - 2026-09-27
4
+
5
+ ### Fixed
6
+ - Keep `RouterTogglyProvider` hook order stable when route selection changes while retaining loader and fallback context hydration [OPS-1451].
7
+ - Surface invalid React Router context errors to the application's Error Boundary instead of intercepting loader hooks [OPS-1451].
3
8
 
4
9
  ## [1.2.0] - 2026-09-26
5
10
 
package/dist/client.cjs CHANGED
@@ -320,7 +320,7 @@ function createBrowserTelemetry(config) {
320
320
 
321
321
  // src/client/sdk-identity.ts
322
322
  var SDK_ID = "react-router";
323
- var SDK_VERSION = "1.2.0";
323
+ var SDK_VERSION = "1.2.1";
324
324
  function appendSdkQueryParams(params) {
325
325
  params.set("sdk", SDK_ID);
326
326
  params.set("sdkVersion", SDK_VERSION);
@@ -1060,27 +1060,19 @@ function RouterTogglyProvider({
1060
1060
  config,
1061
1061
  ...props
1062
1062
  }) {
1063
- let serverContext;
1064
- try {
1065
- if (routeId) {
1066
- const routeData = reactRouter.useRouteLoaderData(routeId);
1067
- serverContext = routeData?.[TOGGLY_LOADER_KEY];
1068
- } else {
1069
- const loaderData = reactRouter.useLoaderData();
1070
- serverContext = loaderData?.[TOGGLY_LOADER_KEY];
1071
- }
1072
- } catch {
1073
- serverContext = fallbackContext;
1074
- }
1075
- serverContext = serverContext ?? fallbackContext;
1076
- const mergedConfig = config ?? (serverContext ? {
1077
- appKey: serverContext.appKey,
1078
- environment: serverContext.environment
1063
+ const routeData = reactRouter.useRouteLoaderData(routeId ?? "");
1064
+ const loaderData = reactRouter.useLoaderData();
1065
+ const data = routeId ? routeData : loaderData;
1066
+ const serverContext = data?.[TOGGLY_LOADER_KEY];
1067
+ const resolvedServerContext = serverContext ?? fallbackContext;
1068
+ const mergedConfig = config ?? (resolvedServerContext ? {
1069
+ appKey: resolvedServerContext.appKey,
1070
+ environment: resolvedServerContext.environment
1079
1071
  } : void 0);
1080
1072
  return /* @__PURE__ */ jsxRuntime.jsx(
1081
1073
  TogglyProvider,
1082
1074
  {
1083
- serverContext,
1075
+ serverContext: resolvedServerContext,
1084
1076
  config: mergedConfig,
1085
1077
  ...props,
1086
1078
  children