Skip to content

Fix: configure using emptyStateDescription #15348

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

Conversation

borjajimnz
Copy link
Contributor

Description

As described in #14990, I'm not sure if this is the expected behavior. At least for me, it seems to be. @danharrin

This is the current priority order:

  1. Resource
  2. Configure using
  3. If nothing is set, but the create action is there, it will display the "Create a %% to get started." text.

Visual changes

https://youtu.be/1gzuXzNHWDs

Functional changes

  • Code style has been fixed by running the composer cs command.
  • Changes have been tested to not break existing functionality.
  • Documentation is up-to-date.

@danharrin danharrin added this to the v3 milestone Feb 3, 2025
@danharrin danharrin added the bug Something isn't working label Feb 3, 2025
@CodeWithDennis
Copy link
Contributor

Came here to look for exactly this issue.

 Table::configureUsing(function (Table $table): void {
     $table->emptyStateDescription(__('It looks like we couldn\'t find any records'));
 });

Is this gonna be merged in the current version or waiting for V4?

@danharrin
Copy link
Member

I'm not sure yet, I don't think the implementation is right here but I've not had time to work out a proper alternative

@CodeWithDennis
Copy link
Contributor

This idea is "somewhat" related but doesn't fix the issue itself.

Wouldn't it make sense to replace the following with a default description as well, since that's what getEmptyStateHeading also does?

public function getEmptyStateDescription(): string | Htmlable | null
{
    return $this->evaluate($this->emptyStateDescription);
}

Replace with:

public function getEmptyStateDescription(): string | Htmlable | null
{
    return $this->evaluate($this->emptyStateDescription) ?? __('filament-tables::table.empty.description', [
        'model' => $this->getModelLabel(),
    ]);
}

@danharrin
Copy link
Member

Would break being able to remove the description with emptyStateDescription(null)

@danharrin
Copy link
Member

In v4 I have changed the feature so that any parent defined configure() statements are called before setUp(), and any child ones are called after setUp() - c91a51d

This will hopefully prevent similar issues in the future

@danharrin danharrin closed this Apr 27, 2025
@github-project-automation github-project-automation bot moved this from In Progress to Done in Roadmap Apr 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

3 participants