Skip to content

Conversation

@aceysmith
Copy link
Contributor

@aceysmith aceysmith commented Dec 27, 2025

Description of Changes

Update the useTable hook in the spacetimedb/react package to use the client language convention aware table accessor key to lookup the correct table

API and ABI breaking changes

None

Expected complexity level and risk

1

Testing

I built and ran a client using this code change before and after. Previously with multi-word table names in rust module (i.e. crew_assignments table), the useTable hook would fail to lookup the table information and hookup the onInsert/onDelete/onUpdate callbacks. With this change, they successfully connect and data returned by the useTable hook now flows.

All of my testing was with module_bindings generated with the 1.11.0 rust module crate. Additional testing for backwards compatibility might be useful. I'm not sure what the clockwork labs target is for that sort of thing.

Copy link
Contributor

@kistz kistz left a comment

Choose a reason for hiding this comment

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

After testing I can confirm that this patch works as expected and my multi word table and views names show the desired output :)

Copy link
Contributor

@cloutiertyler cloutiertyler left a comment

Choose a reason for hiding this comment

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

Thank you for this contribution. This is indeed correct. We will also want to add a regression test for this case.

@cloutiertyler cloutiertyler added this pull request to the merge queue Dec 29, 2025
Merged via the queue into clockworklabs:master with commit 025ec18 Dec 29, 2025
23 checks passed
@aceysmith aceysmith deleted the fix-useTable-for-multi-word-tables branch December 30, 2025 08:54
jdetter pushed a commit that referenced this pull request Dec 31, 2025
…le db view (#3932)

# Description of Changes

Update the `useTable` hook in the `spacetimedb/react` package to use the
client language convention aware table accessor key to lookup the
correct table

# API and ABI breaking changes

None

# Expected complexity level and risk

1

# Testing

I built and ran a client using this code change before and after.
Previously with multi-word table names in rust module (i.e.
`crew_assignments` table), the useTable hook would fail to lookup the
table information and hookup the onInsert/onDelete/onUpdate callbacks.
With this change, they successfully connect and data returned by the
useTable hook now flows.

All of my testing was with module_bindings generated with the 1.11.0
rust module crate. Additional testing for backwards compatibility might
be useful. I'm not sure what the clockwork labs target is for that sort
of thing.
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.

3 participants