Skip to content

Add offline support to <ReferenceInputBase>, <ReferenceInput> and <AutocompleteInput> #10864

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

Open
wants to merge 1 commit into
base: next
Choose a base branch
from

Conversation

djhi
Copy link
Collaborator

@djhi djhi commented Jul 29, 2025

Problem

Our components and hooks can't leverage the offline support provided by Tanstack Query.

Solution

  • Make sure our data loading hooks returns the data needed to detect those cases
  • Provide components, hooks and props allowing to handle offline scenarios
  • Provide default offline components in ra-ui-materialui

How To Test

Additional Checks

  • The PR targets master for a bugfix or a documentation fix, or next for a feature
  • The PR includes unit tests (if not possible, describe why)
  • The PR includes one or several stories (if not possible, describe why)
  • The documentation is up to date

Also, please make sure to read the contributing guidelines.

@@ -340,6 +341,27 @@ const UserCountry = () => {
}
```

## `offline`
Copy link
Contributor

Choose a reason for hiding this comment

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

We should document this in AutocompleteArrayInput too, as it's inheriting this property.

({
sort: currentSort,
allChoices: finalData,
availableChoices: possibleValuesData,
Copy link
Contributor

Choose a reason for hiding this comment

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

You removed the default value of possibleValuesData, it can now be undefined / null. Not sure that it's a problem but to ensure retrocompatiblity:

Suggested change
availableChoices: possibleValuesData,
availableChoices: possibleValuesData ?? [],

@Madeorsk Madeorsk force-pushed the offline-support-reference-one-field branch from 2f737ed to 29c4c07 Compare August 12, 2025 09:22
@Madeorsk Madeorsk force-pushed the offline-support-reference-input branch from 494b79c to d26a330 Compare August 12, 2025 09:26
Base automatically changed from offline-support-reference-one-field to next August 12, 2025 11:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review
Development

Successfully merging this pull request may close these issues.

2 participants