Skip to content

feat: octane adapter - #345

Merged
KevinVandy merged 4 commits into
mainfrom
octane-adapter
Jul 31, 2026
Merged

feat: octane adapter#345
KevinVandy merged 4 commits into
mainfrom
octane-adapter

Conversation

@KevinVandy

@KevinVandy KevinVandy commented Jul 31, 2026

Copy link
Copy Markdown
Member

🎯 Changes

✅ Checklist

  • I have followed the steps in the Contributing guide.
  • I have tested this code locally with pnpm test:pr.

🚀 Release Impact

  • This change affects published code, and I have generated a changeset.
  • This change is docs/CI/dev-only (no release).

Summary by CodeRabbit

  • New Features

    • Added Octane support for TanStack Store through atoms, stores, selectors, actions, and typed store contexts.
    • Added installation guidance, API references, quick-start instructions, and interactive Octane examples.
    • Added support for server-side rendering with Octane store bindings.
  • Documentation

    • Updated supported-framework listings and navigation to include Octane.
    • Added comprehensive usage examples and API documentation.
  • Tests

    • Added coverage for subscriptions, selectors, providers, SSR, type safety, and API compatibility.

@nx-cloud

nx-cloud Bot commented Jul 31, 2026

Copy link
Copy Markdown

View your CI Pipeline Execution ↗ for commit 6010d2e

Command Status Duration Result
nx affected --targets=test:sherif,test:knip,tes... ✅ Succeeded 2m 14s View ↗
nx run-many --target=build --exclude=examples/** ✅ Succeeded <1s View ↗

☁️ Nx Cloud last updated this comment at 2026-07-31 02:16:12 UTC

@coderabbitai

coderabbitai Bot commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Added the @tanstack/octane-store adapter with selector, atom, store, and context hooks. Added conformance, type, parity, and SSR tests. Added five Octane examples, documentation, workspace configuration, and release metadata.

Changes

Octane adapter

Layer / File(s) Summary
Adapter package and hook implementation
packages/octane-store/src/*, packages/octane-store/package.json, packages/octane-store/*config*
Added the Octane package, public exports, slot utilities, selector synchronization, atom/store creation hooks, useAtom, and typed store contexts.
Conformance, type, and SSR validation
packages/octane-store/tests/*
Added runtime fixtures, conformance tests, export parity checks, type inference tests, mounting helpers, lifecycle cleanup, and SSR coverage.

Octane examples

Layer / File(s) Summary
Example applications
examples/octane/*
Added atom, simple store, store actions, store context, and store hooks examples with TSRX entrypoints, Vite configuration, manifests, HTML shells, and setup documentation.

Framework documentation

Layer / File(s) Summary
Installation, quick start, and API references
docs/framework/octane/*, docs/installation.md, docs/overview.md
Added Octane installation instructions, a quick-start guide, hook and context references, and framework listings.
Documentation navigation and generation
docs/config.json, scripts/generate-docs.ts
Added navigation for Octane pages and examples. Added post-processing for generated overload headings and signatures.

Workspace and release metadata

Layer / File(s) Summary
Workspace and package release wiring
package.json, pnpm-workspace.yaml, .changeset/*, packages/octane-store/CHANGELOG.md, README.md
Added workspace package resolution, the Octane examples workspace glob, release metadata, changelog content, and supported-framework listings.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant Component
  participant useSelector
  participant StoreOrAtom
  participant OctaneSync
  Component->>useSelector: pass store or atom and selector
  useSelector->>StoreOrAtom: read snapshot and subscribe
  useSelector->>OctaneSync: provide selector and comparator
  OctaneSync-->>Component: return selected value
  StoreOrAtom-->>OctaneSync: notify state changes
Loading

Possibly related PRs

  • TanStack/store#306: Ports matching hooks and createStoreContext APIs from the React Store adapter.

Suggested reviewers: crutchcorn

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the template sections but leaves the change summary empty and all checklist and release-impact items unchecked. Describe the Octane adapter changes, complete the checklist, and select the applicable release-impact option; confirm the changeset if published code is affected.
Docstring Coverage ⚠️ Warning Docstring coverage is 7.69% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the main change: adding the Octane adapter.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch octane-adapter

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown
@tanstack/angular-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/angular-store@345

@tanstack/lit-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/lit-store@345

@tanstack/octane-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/octane-store@345

@tanstack/preact-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/preact-store@345

@tanstack/react-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/react-store@345

@tanstack/solid-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/solid-store@345

@tanstack/store

npm i https://pkg.pr.new/TanStack/store/@tanstack/store@345

@tanstack/svelte-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/svelte-store@345

@tanstack/vue-store

npm i https://pkg.pr.new/TanStack/store/@tanstack/vue-store@345

commit: 57b3885

@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Review the following changes in direct dependencies. Learn more about Socket for GitHub.

Diff Package Supply Chain
Security
Vulnerability Quality Maintenance License
Addedoctane@​0.1.21751008397100
Addedvite@​8.1.5981008298100
Addedtypescript@​5.9.31001009010090

View full report

@socket-security

socket-security Bot commented Jul 31, 2026

Copy link
Copy Markdown

Warning

Review the following alerts detected in dependencies.

According to your organization's Security Policy, it is recommended to resolve "Warn" alerts. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Warn High
Obfuscated code: npm @emnapi/runtime is 90.0% likely obfuscated

Confidence: 0.90

Location: Package overview

From: pnpm-lock.yamlnpm/tsdown@0.21.7npm/@angular-devkit/build-angular@21.2.7npm/@analogjs/vite-plugin-angular@2.4.5npm/knip@6.4.0npm/vite@8.1.5npm/@emnapi/runtime@1.11.1

ℹ Read more on: This package | This alert | What is obfuscated code?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should not obfuscate their code. Consider not using packages with obfuscated code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@emnapi/runtime@1.11.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Low adoption: npm octane

Location: Package overview

From: examples/octane/atoms/package.jsonnpm/octane@0.1.21

ℹ Read more on: This package | This alert | What are unpopular packages?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Unpopular packages may have less maintenance and contain other problems.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/octane@0.1.21. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 7

🧹 Nitpick comments (3)
packages/octane-store/tests/_fixtures/conformance.tsrx (2)

140-149: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Nit: ContextValue names both a type and a component.

Legal (separate namespaces) but confusing; consider ContextValueDisplay for the component.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/octane-store/tests/_fixtures/conformance.tsrx` around lines 140 -
149, Rename the ContextValue component to ContextValueDisplay while keeping the
ContextValue type unchanged, and update any references to the component
accordingly.

55-55: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Nit: value as string on numeric values is a misleading cast.

These values are number; interpolating directly (or String(value)) is clearer than asserting string.

Also applies to: 118-118, 148-148, 166-166, 178-178

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/octane-store/tests/_fixtures/conformance.tsrx` at line 55, Update
the interpolations in the conformance fixture, including the switched value and
the additional referenced occurrences, to use the numeric values directly or
convert them with String(value) instead of asserting value as string. Preserve
the existing rendered output and fixture behavior.
packages/octane-store/src/useStore.ts (1)

5-10: 📐 Maintainability & Code Quality | 🔵 Trivial | 💤 Low value

Share SelectionSource instead of duplicating it.

Identical to SelectionSource in useSelector.ts (Lines 13-18). Export it there and import the type here so the two definitions cannot drift.

♻️ Proposed refactor
 import { splitSlot } from './internal'
 import { useSelector } from './useSelector'
-import type { UseSelectorOptions } from './useSelector'
-
-type SelectionSource<T> = {
-  get: () => T
-  subscribe: (listener: (value: T) => void) => {
-    unsubscribe: () => void
-  }
-}
+import type { SelectionSource, UseSelectorOptions } from './useSelector'
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/octane-store/src/useStore.ts` around lines 5 - 10, Remove the
duplicate SelectionSource type from useStore.ts, export SelectionSource from
useSelector.ts, and import the shared type into useStore.ts. Preserve the
existing get and subscribe contract while ensuring both modules reference the
single definition.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@docs/config.json`:
- Around line 88-96: Add an octane entry to the Examples.frameworks navigation
list in docs/config.json, including links for Simple, Atoms, Stores, Store
Actions, and Store Context. Follow the existing framework entry structure and
use the corresponding Octane example routes.

In `@docs/framework/octane/reference/functions/useAtom.md`:
- Around line 8-10: Update the useAtom<TValue> declaration to type its setter as
Atom<TValue>['set'], matching the implementation’s returned setter;
alternatively, document the equivalent explicit overloads for direct values and
updater callbacks instead of the current intersected function signature.

In `@docs/framework/octane/reference/functions/useCreateAtom.md`:
- Around line 48-51: Update the documentation generator/template that emits
overload headings so each generated heading is unique instead of repeating “Call
Signature.” Apply the change to
docs/framework/octane/reference/functions/useCreateAtom.md lines 48-51,
docs/framework/octane/reference/functions/useCreateStore.md lines 44-47, and
docs/framework/octane/reference/functions/useCreateStore.md lines 80-83, using
distinct names for the second atom overload, second store overload, and actions
overload.

In `@docs/overview.md`:
- Line 6: Update the TanStack Store description sentence to hyphenate both
compound modifiers: use “framework-agnostic” and “framework-specific,” while
preserving the rest of the wording.

In `@examples/octane/stores/src/index.tsrx`:
- Around line 69-72: Update the TotalCard component’s displayed label to
describe the cats-and-dogs total calculated by its useSelector callback,
replacing the incorrect “Total votes” wording while leaving the selector and
total computation unchanged.

In `@packages/octane-store/src/useCreateStore.ts`:
- Around line 25-55: Update useCreateStore to derive and pass a dedicated
sub-slot to useState, using the same subSlot pattern as useCreateAtom and the
'create-store' identifier, instead of forwarding the raw slot returned by
splitSlot. Keep the existing store initialization and overload behavior
unchanged.

In `@packages/octane-store/src/useSelector.ts`:
- Around line 58-60: Hoist the omitted-selector fallback used by useSelector
into a stable module-level function or constant, and reuse it when user[0] is
absent. Keep the existing generic selection behavior while ensuring the selector
reference remains unchanged across renders so useSyncExternalStoreWithSelector
memoization is preserved.

---

Nitpick comments:
In `@packages/octane-store/src/useStore.ts`:
- Around line 5-10: Remove the duplicate SelectionSource type from useStore.ts,
export SelectionSource from useSelector.ts, and import the shared type into
useStore.ts. Preserve the existing get and subscribe contract while ensuring
both modules reference the single definition.

In `@packages/octane-store/tests/_fixtures/conformance.tsrx`:
- Around line 140-149: Rename the ContextValue component to ContextValueDisplay
while keeping the ContextValue type unchanged, and update any references to the
component accordingly.
- Line 55: Update the interpolations in the conformance fixture, including the
switched value and the additional referenced occurrences, to use the numeric
values directly or convert them with String(value) instead of asserting value as
string. Preserve the existing rendered output and fixture behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: ecc8c45e-55d3-4367-a4c9-57618d20189b

📥 Commits

Reviewing files that changed from the base of the PR and between 78e3f86 and 99c1d0e.

⛔ Files ignored due to path filters (1)
  • pnpm-lock.yaml is excluded by !**/pnpm-lock.yaml
📒 Files selected for processing (75)
  • .changeset/calm-octanes-store.md
  • README.md
  • docs/config.json
  • docs/framework/octane/quick-start.md
  • docs/framework/octane/reference/functions/createStoreContext.md
  • docs/framework/octane/reference/functions/useAtom.md
  • docs/framework/octane/reference/functions/useCreateAtom.md
  • docs/framework/octane/reference/functions/useCreateStore.md
  • docs/framework/octane/reference/functions/useSelector.md
  • docs/framework/octane/reference/functions/useStore.md
  • docs/framework/octane/reference/index.md
  • docs/framework/octane/reference/interfaces/UseSelectorOptions.md
  • docs/installation.md
  • docs/overview.md
  • examples/octane/atoms/README.md
  • examples/octane/atoms/index.html
  • examples/octane/atoms/package.json
  • examples/octane/atoms/src/index.tsrx
  • examples/octane/atoms/tsconfig.json
  • examples/octane/atoms/vite.config.ts
  • examples/octane/simple/README.md
  • examples/octane/simple/index.html
  • examples/octane/simple/package.json
  • examples/octane/simple/src/index.tsrx
  • examples/octane/simple/tsconfig.json
  • examples/octane/simple/vite.config.ts
  • examples/octane/store-actions/README.md
  • examples/octane/store-actions/index.html
  • examples/octane/store-actions/package.json
  • examples/octane/store-actions/src/index.tsrx
  • examples/octane/store-actions/tsconfig.json
  • examples/octane/store-actions/vite.config.ts
  • examples/octane/store-context/README.md
  • examples/octane/store-context/index.html
  • examples/octane/store-context/package.json
  • examples/octane/store-context/src/index.tsrx
  • examples/octane/store-context/tsconfig.json
  • examples/octane/store-context/vite.config.ts
  • examples/octane/stores/README.md
  • examples/octane/stores/index.html
  • examples/octane/stores/package.json
  • examples/octane/stores/src/index.tsrx
  • examples/octane/stores/tsconfig.json
  • examples/octane/stores/vite.config.ts
  • package.json
  • packages/octane-store/CHANGELOG.md
  • packages/octane-store/eslint.config.js
  • packages/octane-store/package.json
  • packages/octane-store/src/createStoreContext.ts
  • packages/octane-store/src/index.ts
  • packages/octane-store/src/internal.ts
  • packages/octane-store/src/useAtom.ts
  • packages/octane-store/src/useCreateAtom.ts
  • packages/octane-store/src/useCreateStore.ts
  • packages/octane-store/src/useSelector.ts
  • packages/octane-store/src/useStore.ts
  • packages/octane-store/src/useSyncExternalStoreWithSelector.ts
  • packages/octane-store/tests/_fixtures/conformance.tsrx
  • packages/octane-store/tests/_fixtures/conformance.tsrx.d.ts
  • packages/octane-store/tests/_fixtures/server.tsrx
  • packages/octane-store/tests/_fixtures/server.tsrx.d.ts
  • packages/octane-store/tests/_helpers.ts
  • packages/octane-store/tests/conformance/binding.test.ts
  • packages/octane-store/tests/parity.test.ts
  • packages/octane-store/tests/ssr/server.test.ts
  • packages/octane-store/tests/test-setup.ts
  • packages/octane-store/tests/test.test-d.ts
  • packages/octane-store/tsconfig.build.json
  • packages/octane-store/tsconfig.docs.json
  • packages/octane-store/tsconfig.json
  • packages/octane-store/tsdown.config.ts
  • packages/octane-store/vitest.config.ts
  • packages/octane-store/vitest.ssr.config.ts
  • pnpm-workspace.yaml
  • scripts/generate-docs.ts

Comment thread docs/config.json
Comment thread docs/framework/octane/reference/functions/useAtom.md
Comment thread docs/framework/octane/reference/functions/useCreateAtom.md Outdated
Comment thread docs/overview.md Outdated
Comment thread examples/octane/stores/src/index.tsrx Outdated
Comment on lines +25 to +55
export function useCreateStore<T>(
getValue: (prev?: NoInfer<T>) => T,
): ReadonlyStore<T>
export function useCreateStore<T>(initialValue: T): Store<T>
export function useCreateStore<T, TActions extends StoreActionMap>(
initialValue: NonFunction<T>,
actions: StoreActionsFactory<T, TActions>,
): Store<T, TActions>
export function useCreateStore<T, TActions extends StoreActionMap>(
valueOrFn: T | ((prev?: T) => T),
...rest: [actions?: StoreActionsFactory<T, TActions>, slot?: symbol]
): Store<T, TActions> | Store<T> | ReadonlyStore<T> {
const [user, slot] = splitSlot(rest)
const actions = user[0] as StoreActionsFactory<T, TActions> | undefined
const [store] = useState<Store<T, TActions> | Store<T> | ReadonlyStore<T>>(
() => {
if (typeof valueOrFn === 'function') {
return createStore(valueOrFn as (prev?: NoInfer<T>) => T)
}

if (actions) {
return createStore(valueOrFn as NonFunction<T>, actions)
}

return createStore(valueOrFn)
},
slot,
)

return store
}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🌐 Web query:

octane framework useState hook slot argument API plain TypeScript custom hooks

💡 Result:

In the Octane framework, the useState hook is part of a compiled programming model that eliminates the traditional rules of hooks by assigning each hook call to a stable, compiler-tracked slot [1][2][3][4]. Regarding your specific queries: useState Slot Argument API There is no "slot argument" that you manually pass to the useState hook. Instead, the Octane compiler automatically assigns each hook call to a unique, stable call-site slot during the build process [3][4]. Because hooks are tracked by this slot rather than by the order in which they are called, you can safely use useState inside conditional blocks (e.g., if statements) or after early returns [2][3][5]. The only restriction regarding these slots is that you must not call a hook directly inside a plain JavaScript loop, as every iteration would share the same call-site slot [2][3][4]. To loop over data, you should use the keyed @for directive or move the hook into a child component that is rendered within a list [1][2][6]. useState API Details The useState hook returns a tuple with an optional third element [1][4]: const [value, setValue, getValue] = useState(initial); 1. value: The current state value for the render. 2. setValue: A function to schedule the next value. 3. getValue: An optional, stable function that reads the latest scheduled state [1][2]. This is intended for use in asynchronous or delayed callbacks to avoid stale state closures, serving as a replacement for the common React pattern of using a ref for this purpose [2][4]. Plain TypeScript and Custom Hooks Octane is a TypeScript-first framework and fully supports custom hooks [7]. When you create custom hooks in a file compiled by Octane (typically.tsrx or.tsx files), the compiler can infer dependency lists for hooks like useEffect and useMemo based on lexical captures [7]. To enable this automatic dependency inference in your own custom hooks, ensure the implementation transparently forwards a callback and its final dependency parameter to an underlying Octane hook [7]. This inference is local and conservative; custom hooks defined in plain.ts/.js modules or those that transform/inspect their parameters still require explicit dependency arrays [7].

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== locate relevant files =="
git ls-files | rg '(^|/)useCreateStore\.ts$|createStore|useState|package\.json$|tsconfig|README|doc' || true

echo
echo "== package files mentioning octane versions =="
rg -n '"`@octane`|octane|0\.1\.21|useState|useCreateStore|createStore' package.json packages/*/package.json 2>/dev/null || true

echo
echo "== inspect useCreateStore.ts =="
if [ -f packages/octane-store/src/useCreateStore.ts ]; then
  cat -n packages/octane-store/src/useCreateStore.ts
fi

echo
echo "== inspect likely createStore implementation and useState declarations =="
rg -n "function useState|const useState|export .*useState|function createStore|const createStore|export .*createStore" packages -S || true

Repository: TanStack/store

Length of output: 15073


🌐 Web query:

TanStack Store useCreateStore slot forwarding useState octane slot documentation

💡 Result:

Based on the official TanStack Store documentation and related project resources, here is the synthesis regarding your query: useCreateStore and useState In TanStack Store, useCreateStore is a React hook designed to create a stable store instance for the lifetime of a component [1][2]. Internally, it utilizes the standard React useState hook to ensure that the store is instantiated only once per mount [2]. When you call useCreateStore, it provides a stable store (either mutable or read-only/derived) that persists across re-renders [1][2]. Slot Forwarding The concept of slot forwarding, while often discussed in the context of component composition and frameworks like TanStack Start [3], is not a native pattern or explicitly documented feature within the core TanStack Store library itself. TanStack Store focuses on reactive state management primitives (stores and atoms) rather than component-level slot propagation [4][5]. If you are working with component slots (such as passing children or render props), this is typically handled by your framework (e.g., React or TanStack Start) [3]. Octane Octane is a separate, compiled UI framework that aims to provide a React-like programming model without a virtual DOM [6][7]. It includes official bindings for many popular libraries, including a package for TanStack Store (@octanejs/tanstack-store) [8]. According to Octane's documentation, when using these bindings, you generally follow the upstream library's (TanStack Store) documentation for store and selector APIs, as the Octane-specific package is essentially a port designed to work within the Octane compiled environment [6]. Summary There is no specific "slot forwarding" documentation for TanStack Store because it is a state management library, not a component composition library [5]. For integrating TanStack Store with Octane, you should rely on the standard TanStack Store documentation [1][9], utilizing the provided Octane bindings as indicated in the Octane project documentation [6]. Top Results: [1] https://tanstack.com/store/latest/docs/framework/react/reference/functions/useCreateStore [2] https://github.com/TanStack/store/blob/main/packages/react-store/src/useCreateStore.ts [3] https://tanstack.com/start/latest/docs/framework/react/guide/server-components [6] https://octanejs.dev/docs/bindings [8] https://github.com/octanejs/octane/blob/dedda5e6/README.md

Citations:


🌐 Web query:

octane useState signature slot parameter source

💡 Result:

In the Octane framework, the hook useState differs from React in how it handles hook identification and its returned tuple. Slot-based identification Unlike React, which relies on the order of hook calls (the Rules of Hooks), Octane tracks hooks by their unique source location [1][2]. Each hook call site is assigned a stable, compiler-calculated slot [3]. This allows hooks to be called conditionally or after early returns without desyncing state [1][2][3]. Because slots are tied to the source location, developers should not call slot-based hooks within plain JavaScript loops; the compiler will report an error if it detects multiple iterations sharing the same source location [1][4]. Instead, developers are encouraged to use keyed @for or move the hook into a child component [1][4]. useState signature and the third tuple parameter While useState supports the standard two-item return (state and setter), Octane extends this with an optional third tuple item: a stable getter function that reads the latest scheduled state [1][3][5]. Signature: const [state, setState, getState] = useState(initialValue); The getState function is stable and allows you to retrieve the most recent state value without triggering a render [3][5]. This is intended to replace the common pattern of synchronizing state to a useRef solely to avoid stale closures in asynchronous callbacks or delayed functions [1][5]. The Octane compiler is optimized to observe whether the third index is destructured; if it is not, the code remains on the standard, efficient two-item execution path [1][5]. This third-parameter feature is also available for useReducer [3][5].

Citations:


🌐 Web query:

"octanejs" "useState" "slot" "@tanstack/store" "useCreateStore"

💡 Result:

In Octane (octanejs), useState does not use slots in the traditional React-like sense; instead, hooks are identified by their source location [1][2]. The Octane compiler assigns a stable slot to each hook call site, which allows hooks to be safely used behind conditions or after early returns without desyncing state [1][2]. An optional third tuple item is available in useState for a stable getter function, which reads the latest scheduled state without triggering a re-render [3][2]. Regarding @tanstack/store, useCreateStore is a React-specific hook used to create a stable store instance for the lifetime of a component [4][5]. It ensures the store is instantiated only once upon mounting, mirroring the overloads of the base createStore function [4][6]. It is part of the @tanstack/react-store package and internally uses React's useState to maintain the store instance's stability [6][7].

Citations:


🌐 Web query:

"octane" "const" "[state, setState] = useState" "@tanstack/store"

💡 Result:

In the context of the Octane framework and its integration with TanStack Store, the syntax const [state, setState] = useState @tanstack/store does not exist as a standard API. Instead, Octane provides a specific binding package, @octanejs/tanstack-store, to bridge TanStack Store with its reactivity model [1]. The Octane documentation clarifies that for TanStack Store usage, developers should use the provided hooks such as useSelector [1]. The experimental _useStore hook—which mirrors the tuple pattern [state, setState]—is explicitly omitted in the Octane bindings to favor cleaner API patterns like using useSelector alongside direct store methods [2][1]. For standard React applications using @tanstack/react-store, the primary hooks are useStore (which is a selector-based subscription hook) and occasionally _useStore (experimental) for those needing a tuple-based read/write pattern [3][2][4]. If you are working within an Octane project, refer to the following guidelines: 1. Install the official binding: @octanejs/tanstack-store [1]. 2. Use useSelector to subscribe to specific slices of store state [1]. 3. Perform state updates directly on the store instance using store.setState or actions [1]. Avoid attempting to use useState-like patterns directly with TanStack Store, as the library is designed for fine-grained, selector-based reactivity rather than standard component-local state [4][5].

Citations:


🌐 Web query:

"splitSlot" "octane" "useState"

💡 Result:

There is no single concept or API called splitSlot in the context of Octane (the React-compatible compiled framework) or useState. It appears you may be conflating two distinct features or frameworks: 1. Octane (the compiled React-like framework) uses slot-based tracking for hooks, meaning hooks like useState are tracked by their source location in the code rather than their execution order [1][2]. This allows hooks to be called conditionally (e.g., after an early return) without desyncing state [1][2]. 2. Qwik (a different framework often associated with "islands" and performance) uses a concept called slots for content projection, which allows components to accept and render children in specific named areas [3][4][5]. If you are seeing the term "splitSlot" in your environment, it is likely either a custom implementation in your codebase, a misinterpretation of Octane's "slot-based" hook tracking [1], or a combination of Qwik's slot system [3] and a splitting/lazy-loading strategy (like Qwik's code-splitting) [6]. If you are working with Octane and useState, you use them just as you would in React: const [count, setCount] = useState(0); Octane also supports an optional third tuple item for state if you need to read the latest scheduled state in long-lived callbacks: const [value, setValue, getValue] = useState(initial); [1][6][2]

Citations:


🌐 Web query:

"octane" "internal" "splitSlot"

💡 Result:

The term splitSlot does not refer to a unified concept, but rather appears in multiple, distinct technical contexts depending on the software or framework being referenced. 1. Kuzu Database (Hash Indexing): In the Kuzu database, splitSlot is a method used during the resizing of a hash index [1][2]. When the hash index reaches a threshold, splitSlot is invoked to rehash entries from an existing slot into a new slot, effectively doubling the capacity of the index [1][2]. 2. Apache Spark (Kubernetes Scheduler): In the context of Apache Spark's Kubernetes executor allocator, splitSlots (often appearing in plural) refers to a logic block involved in managing and allocating executor slots [3]. A specific optimization involves skipping this code block when no snapshots are received from the Kubernetes control plane to avoid unnecessary resource allocation attempts [3]. 3. Octane Framework (Context of "slots"): In the Octane UI framework, while there is no single method explicitly named splitSlot, the framework makes extensive use of the term slot in its compiler-driven hook management [4][5]. Octane utilizes a "hook slot" system where the compiler assigns numeric IDs (slots) to hooks [4]. When developers refer to "splitting" in Octane, they are typically referring to the compiler's code-splitting feature for deferred hydration (e.g., the split prop on the Hydrate component), which separates child components into deferred chunks [6][7][8]. 4. SKAO MCCS (Data Acquisition): In the SKA Observatory's MCCS data acquisition software, SplitSlot is a data structure used in a ring buffer implementation to handle packet data, involving state management for concurrent read/write operations [9]. If you are researching a specific codebase, verify which of these domains (Database Indexing, Distributed Computing, UI Frameworks, or Embedded Systems) matches your environment.

Citations:


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "== octane-store package deps and files =="
cat -n packages/octane-store/package.json
echo
git ls-files packages/octane-store

echo
echo "== octane-store source =="
find packages/octane-store/src -maxdepth 2 -type f -print | sort | while read -r f; do
  echo "---- $f ----"
  wc -l "$f"
  cat -n "$f"
done

echo
echo "== examples using octane tanstack-store hook imports =="
rg -n "useCreateStore|from ['\"`@tanstack`|from ['\"]octane|splitSlot|useStore|useSelector" examples/octane packages/octane-store -S || true

echo
echo "== lockfile/octane refs if present =="
for f in pnpm-lock.yaml package-lock.json yarn.lock bun.lockb bun.lock; do
  if [ -f "$f" ]; then
    echo "---- $f ----"
    rg -n "octane|`@tanstack/store`|tanstack-store" "$f" | head -80 || true
  fi
done

Repository: TanStack/store

Length of output: 25785


Forward the split slot sub-slot into useState.

packages/octane-store/src/internal.ts documents that plain .ts hooks split a compiler-forwarded slot and derive per-call-site sub-slots for composed hooks. useCreateStore passes the raw slot to octane’s useState(...), but packages/octane-store/src/useCreateAtom.ts uses subSlot(slot), so useState((initFn, slot => subSlot(slot, 'create-store')) matches the binding’s established manual-slot-forwarding pattern.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@packages/octane-store/src/useCreateStore.ts` around lines 25 - 55, Update
useCreateStore to derive and pass a dedicated sub-slot to useState, using the
same subSlot pattern as useCreateAtom and the 'create-store' identifier, instead
of forwarding the raw slot returned by splitSlot. Keep the existing store
initialization and overload behavior unchanged.

Comment thread packages/octane-store/src/useSelector.ts Outdated

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
scripts/generate-docs.ts (1)

12-52: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Fail when a required generated-doc match is absent.

markdown.replace(...) and the useAtom transformations silently return unchanged Markdown if TypeDoc changes its output. Check each required source string before writing the file, and fail the documentation task when a match is missing.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@scripts/generate-docs.ts` around lines 12 - 52, Update
replaceOverloadHeadings and the useAtom transformations in
polishOctaneReferenceDocs to verify each required source string exists before
replacing it. Track whether every heading and useAtom pattern matched, and throw
an error before writeFile when any expected match is absent so the documentation
task fails instead of silently writing unchanged output.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In `@scripts/generate-docs.ts`:
- Around line 12-52: Update replaceOverloadHeadings and the useAtom
transformations in polishOctaneReferenceDocs to verify each required source
string exists before replacing it. Track whether every heading and useAtom
pattern matched, and throw an error before writeFile when any expected match is
absent so the documentation task fails instead of silently writing unchanged
output.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 6b5b567d-2df5-4aa3-8e44-ced43e9be193

📥 Commits

Reviewing files that changed from the base of the PR and between 99c1d0e and 57b3885.

📒 Files selected for processing (19)
  • .changeset/calm-octanes-store.md
  • docs/config.json
  • docs/framework/octane/quick-start.md
  • docs/framework/octane/reference/functions/useAtom.md
  • docs/framework/octane/reference/functions/useCreateAtom.md
  • docs/framework/octane/reference/functions/useCreateStore.md
  • docs/framework/octane/reference/functions/useSelector.md
  • docs/framework/octane/reference/index.md
  • docs/overview.md
  • examples/octane/simple/src/index.tsrx
  • examples/octane/stores/src/index.tsrx
  • packages/octane-store/src/index.ts
  • packages/octane-store/src/useSelector.ts
  • packages/octane-store/tests/_fixtures/conformance.tsrx
  • packages/octane-store/tests/_fixtures/conformance.tsrx.d.ts
  • packages/octane-store/tests/conformance/binding.test.ts
  • packages/octane-store/tests/parity.test.ts
  • packages/octane-store/tests/test.test-d.ts
  • scripts/generate-docs.ts
💤 Files with no reviewable changes (5)
  • packages/octane-store/src/index.ts
  • docs/framework/octane/reference/index.md
  • packages/octane-store/tests/conformance/binding.test.ts
  • packages/octane-store/tests/_fixtures/conformance.tsrx.d.ts
  • docs/framework/octane/quick-start.md
🚧 Files skipped from review as they are similar to previous changes (12)
  • .changeset/calm-octanes-store.md
  • docs/framework/octane/reference/functions/useSelector.md
  • docs/framework/octane/reference/functions/useCreateAtom.md
  • examples/octane/stores/src/index.tsrx
  • packages/octane-store/tests/test.test-d.ts
  • docs/overview.md
  • examples/octane/simple/src/index.tsrx
  • docs/framework/octane/reference/functions/useCreateStore.md
  • packages/octane-store/tests/parity.test.ts
  • docs/framework/octane/reference/functions/useAtom.md
  • packages/octane-store/src/useSelector.ts
  • packages/octane-store/tests/_fixtures/conformance.tsrx

@KevinVandy
KevinVandy merged commit 2faec76 into main Jul 31, 2026
9 checks passed
@KevinVandy
KevinVandy deleted the octane-adapter branch July 31, 2026 12:48
@github-actions github-actions Bot mentioned this pull request Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant