Skip to content

Conversation

@ginkelsoft-development
Copy link
Owner

Summary

  • Removed unused url variable that was creating confusion in DELETE request handling
  • Ensures consistency with UrlBuilder behavior

Problem

The datatable component had an inconsistency in DELETE request handling:

  • Line 226: const url = ${action.url}/${row.id}`` (unused variable)
  • Line 228: fetch(action.url, { (correctly using action.url)

This could potentially cause bugs if developers mistakenly use the url variable instead of action.url.

Solution

Removed the unused const url line. The action.url already contains the complete path with ID as built by UrlBuilder:

  • UrlBuilder automatically extracts the ID from the model (UrlBuilder.php:95-109)
  • No manual ID concatenation needed in the frontend
  • Resources only need to specify ->params(['resource' => 'resourceName']) for DELETE actions

Testing

Tested with CouponBuildora delete action:

  • Before: Potential for double ID if url variable was used
  • After: Clean DELETE requests to correct endpoint

🤖 Generated with Claude Code

Problem:
- Line 226 created unused variable: const url = `${action.url}/${row.id}`
- Line 228 correctly used action.url (which already contains the full path with ID from UrlBuilder)
- This inconsistency could cause confusion and potential bugs

Solution:
- Removed the unused url variable construction
- DELETE requests now consistently use action.url which is built by UrlBuilder with all required parameters including the ID

The UrlBuilder automatically extracts the ID from the model (UrlBuilder.php:95-109),
so no manual ID concatenation is needed in the frontend.

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
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