Skip to content
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

navigate the browser to the collection list page #3

Open
xu4wang opened this issue May 7, 2023 · 6 comments
Open

navigate the browser to the collection list page #3

xu4wang opened this issue May 7, 2023 · 6 comments

Comments

@xu4wang
Copy link

xu4wang commented May 7, 2023

Hi , Thanks for the wonderful extension. we are exploring to use it heavily for our business logic implementaiton.

One question, Instead of reload the page after the API call, are we able to navigate the browser to the collection list page inside the onClick function?

I tried modify the reload logic

router.go(0);

into:

router.push('/content/collection1');

However, directus APP will ask the user to confirm leave for the unsaved changes. Actually the changes was already saved inside the API call, is it possible to navigate silently without user confirmation?

@duydvu
Copy link
Contributor

duydvu commented May 8, 2023

It's possible if you can modify the source code of Directus, edit this line to:

useEditsGuard(hasEdits, { ignorePrefix: '/content/collection1' });

It will bypass the confirm dialog if the path to go to starts with this string.

This is the only solution I can think of. I hope this can help you.

@xu4wang
Copy link
Author

xu4wang commented May 8, 2023

It's possible if you can modify the source code of Directus, edit this line to:

useEditsGuard(hasEdits, { ignorePrefix: '/content/collection1' });

It will bypass the confirm dialog if the path to go to starts with this string.

This is the only solution I can think of. I hope this can help you.

Thanks for the workaround. I don't want to touch Directus source code.

Is it possible to change every field into it's original value? Or issue a save command inside the OnClick?

@duydvu
Copy link
Contributor

duydvu commented May 8, 2023

Ah, yes. You can use emit('setFieldValue', { field, value }); to set all fields to their original value. After that, there will be no change that needs to be saved.

@xu4wang
Copy link
Author

xu4wang commented May 8, 2023

Yes. I tried with no luck.

So strange, I set all of them to initial value, I even set all of them to undefined... but still Directus APP thinks there are changes.

@duydvu
Copy link
Contributor

duydvu commented May 8, 2023

Do you have any m2o, o2m, m2m, json field? Because even if you set them to their initial values, Directus still considers them as different values if they do not contain reference to the same object.

@xu4wang
Copy link
Author

xu4wang commented May 8, 2023

I see. Yes there is m2o field. Thanks for the clarification.

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

No branches or pull requests

2 participants