Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
36 changes: 36 additions & 0 deletions fetch-remote.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash

# --- Configuration ---
# Change this to 'origin' if your target beta branch is hosted there instead of 'upstream'
REMOTE="upstream"
TARGET_BRANCH="beta"
# ---------------------

echo "Fetching latest changes from $REMOTE..."
git fetch $REMOTE

# 1. Remember the branch you are currently working on
CURRENT_BRANCH=$(git branch --show-current)

# 2. Switch to the beta branch
echo "Switching to $TARGET_BRANCH..."
git checkout $TARGET_BRANCH

# 3. Fast-forward the local beta branch to match the remote
echo "Updating local $TARGET_BRANCH with $REMOTE/$TARGET_BRANCH..."
if git merge --ff-only $REMOTE/$TARGET_BRANCH; then
echo "✅ $TARGET_BRANCH successfully updated."
else
echo "❌ Error: Could not fast-forward. Do you have accidental local commits on $TARGET_BRANCH?"
# If this fails, you can force it to exactly match the remote by replacing the merge command with:
# git reset --hard $REMOTE/$TARGET_BRANCH
exit 1
fi

# 4. Switch back to your working branch (if you weren't already on beta)
if [ "$CURRENT_BRANCH" != "$TARGET_BRANCH" ]; then
echo "Switching back to your working branch: $CURRENT_BRANCH..."
git checkout "$CURRENT_BRANCH"
fi

echo "Done!"
4 changes: 2 additions & 2 deletions packages/react-table/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,7 @@
"build": "tsdown"
},
"dependencies": {
"@tanstack/react-store": "^0.11.0",
"@tanstack/table-core": "workspace:*"
"@tanstack/react-store": "^0.11.0"
},
"devDependencies": {
"@eslint-react/eslint-plugin": "^5.9.2",
Expand All @@ -75,6 +74,7 @@
"react": "^19.2.7"
},
"peerDependencies": {
"@tanstack/table-core": "workspace:*",
"react": ">=18"
}
}
4 changes: 4 additions & 0 deletions packages/table-core/src/core/columns/coreColumnsFeature.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import {
table_getAllFlatColumnsById,
table_getAllLeafColumns,
table_getAllLeafColumnsById,
table_getCachedColumn,
table_getColumn,
table_getDefaultColumnDef,
} from './coreColumnsFeature.utils'
Expand Down Expand Up @@ -68,6 +69,9 @@ export const coreColumnsFeature: TableFeature = {
table_getColumn: {
fn: (columnId) => table_getColumn(table, columnId),
},
table_getCachedColumn: {
fn: (columnId) => table_getCachedColumn(table, columnId),
},
})
},
}
Original file line number Diff line number Diff line change
Expand Up @@ -105,4 +105,8 @@ export interface Table_Columns<
* Returns a single column by its ID.
*/
getColumn: (columnId: string) => Column<TFeatures, TData, unknown> | undefined
/**
* Returns a single column by its ID, but cached via WeakMap.
*/
getCachedColumn: (columnId: string) => Column<TFeatures, TData, unknown> | undefined
}
20 changes: 20 additions & 0 deletions packages/table-core/src/core/columns/coreColumnsFeature.utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -273,3 +273,23 @@ export function table_getColumn<

return column
}

export function table_getCachedColumn<
TFeatures extends TableFeatures,
TData extends RowData,
>(
table: Table_Internal<TFeatures, TData>,
columnId: string,
): Column<TFeatures, TData, unknown> | undefined {
const columnDefs = table.options.columns
const cache = table._columnCache;

let columnsById = cache.get(columnDefs)

if (!columnsById) {
columnsById = table.getAllFlatColumnsById()
cache.set(columnDefs, columnsById)
}

return columnsById[columnId]
}
2 changes: 2 additions & 0 deletions packages/table-core/src/core/table/constructTable.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ export function constructTable<
_rowModels: {},
_rowModelFns: { aggregationFns, filterFns, sortFns },
baseAtoms: {},
// Import diffs will make updating this hell -> any
_columnCache: new WeakMap<any, any>(),
atoms: {},
} as unknown as Table_Internal<TFeatures, TData>

Expand Down
1 change: 1 addition & 0 deletions packages/table-core/src/types/Table.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,5 @@ export interface Table_Internal<
baseAtoms: BaseAtoms<TFeatures> & BaseAtoms_All
atoms: Atoms<TFeatures> & Atoms_All
store: ReadonlyStore<TableState<TFeatures>> & ReadonlyStore<TableState_All>
_columnCache: WeakMap<any, any>
}