Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use getValues for bindings #426

Draft
wants to merge 11 commits into
base: trunk
Choose a base branch
from
Draft

Use getValues for bindings #426

wants to merge 11 commits into from

Conversation

maxschmeling
Copy link
Contributor

@maxschmeling maxschmeling commented Mar 18, 2025

Uses the getValues argument of registerBlockBindingsSource to retrieve binding values async with core data.

// console.log('store: RECEIVED REMOTE DATA')
// console.log({action});
// console.log(`key: ${queryDataStateKey(action.queryKey, action.blockName, action.queryInput)}`);
return { ...state, [ queryDataStateKey(action.queryKey, action.blockName, action.queryInputs) ]: action.data };
Copy link
Member

Choose a reason for hiding this comment

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

Each query response contains a UUID in the resultId property. Maybe we should use that?

Copy link
Member

Choose a reason for hiding this comment

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

Nevermind, that won't work since the UUIDs will be different on subsequent page loads. 👎

registerBlockBindingsSource( {
name: 'remote-data/binding',
label: 'Remote Data Binding',
usesContext: [ 'remote-data-blocks/remoteData' ],
getValues() {
return {};
getValues( { context, clientId, bindings, select, ...other } ) {
Copy link
Member

Choose a reason for hiding this comment

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

Should we be using setValues too? Or should we be dispatching actions from useRemoteData()?

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.

2 participants