You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Handle route callbacks that reference this during code splitting #8688
Route callbacks that reference this have an existing code-splitting problem. This affects function expressions as well as method-shorthand properties. Address this problem separately from the method-shorthand support in PR #8459.
Establish the supported this contract for route callbacks that can be code-split.
Evaluate enforcing this: void in the route callback types, as proposed in the discussion. This is a possible solution, not a predetermined requirement.
If type restrictions do not fully address the problem, define appropriate compiler handling or diagnostics for unsupported callbacks.
Add regression coverage for function expressions and method-shorthand callbacks that reference this, along with callbacks that do not reference this.
Document any resulting callback restrictions.
Affected areas
Router code-splitting transforms in packages/router-plugin/src/core/code-splitter/compilers.ts.
Route callback type declarations.
Router-plugin code-splitter tests.
Rationale
Extracting a callback into a split module must not silently change its supported this behavior. The problem predates method-shorthand support, so it should not block PR #8459.
Acceptance criteria
The supported this behavior for split route callbacks is explicit.
Unsupported this usage is rejected or diagnosed, or supported usage retains its behavior after code splitting.
Regression tests cover both function expressions and method-shorthand callbacks.
Callbacks that do not reference this continue to split correctly.
Activity