Updating Slug in Modal - Trello Close

Hi Alex,

I have another small issue that seems to be taking too long to solve, so thought I'd ask if you have any ideas.

On the Trello clone, I've created a top-level category called 'Workspace'. This will hold the boards, so I can essentially have a workspace for each client and have all their boards in their workspace and invite them into that workspace.

I have created an 'edit-board' modal component which works perfectly when not updating the slug. Yes, I have added a slug to the board, amongst other fields, so that I can use that instead of IDs, it just looks nicer.

When I update the title I also update the slug at the same time with no issue. I have an event that fires which is caught by the Livewire.on event and this updates the window history, all is good so far.

As soon as I click update on the component it goes to a 404, now I use route model binding on the routes and I'm guessing it's because the slug has changed that's causing this.

Do you have any idea how I might resolve this?

I do have it redirecting after the update which solves this problem but wondered if there was a way to reinitialise the route or something without reloading the entire page, not that it's an issue, of course.

Cheers

Derek

derekbuntin Member
derekbuntin
0
3
153
alex Member
alex
Moderator

Hi Derek

I can't think of a way without being super hacky to change the URL once the slug is updated, a redirect here with Livewire would be the best option.

I'm guessing what you were trying to achieve was to 'refresh' the page and not do a full redirect?

derekbuntin Member
derekbuntin
Solution

Hi Alex,

Yeah but to be fair the redirect works perfectly well so I'll keep that for now.

Thanks

Derek

alex Member
alex
Moderator

Exactly, absolutely nothing wrong with doing it this way :)