pozil/sfdc-ui-lookup-lwc

handleNewRecordClick() redirects to the new record detail page

hackbac opened this issue · 3 comments

When a user selects a newRecordOption and creates a record, the NavigationMixin redirects to the record detail page.
Navigating away from the original component causes the user to lose any changes (e.g. pending form submission data.)
The expected behavior would be for handleNewRecordClick() to return the new record Id as a selected value.

I anticipate that this might be a limitation with NavigationMixin. I haven't been able to figure out a solution, and I'm hoping that someone else here might have an idea. Thanks!

pozil commented

Hi @hackbac, thanks, that's a really good use case you suggested and I hadn't thought about it earlier.

Luckily, I had some free time this morning so I built a pre-navigate callback that lets you run custom logic before navigating away. I've made it available in the latest release (2.8.0).

Such an awesome response. I'll give it a try. Thank you!