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

Fire specific event if allowUserOptions was used to create a new option #263

Open
janosh opened this issue Sep 12, 2023 Discussed in #262 · 1 comment
Open

Fire specific event if allowUserOptions was used to create a new option #263

janosh opened this issue Sep 12, 2023 Discussed in #262 · 1 comment
Labels
enhancement New feature or request

Comments

@janosh
Copy link
Owner

janosh commented Sep 12, 2023

Discussed in #262

Originally posted by igorlanko September 11, 2023
It might be useful if you want to modify the list of tags by POSTing a request to create one.

In my context, I'd need to differentiate between updating a PGSQL table with new item-tag relation link in a many-to-many table, and creating a new tag in the tags table.

What do you think?

@janosh janosh added the enhancement New feature or request label Sep 12, 2023
@janosh
Copy link
Owner Author

janosh commented Sep 12, 2023

@igorlanko Sounds good, happy to take a PR for that. You'd start by adding a new DispatchEvent key

export type DispatchEvents<T = Option> = {
add: { option: T }
create: { option: T }
remove: { option: T }
removeAll: { options: T[] }
change: {
option?: T

and then modifying the add function to check if it's an addition that required allowUserOptions

}
dispatch(`create`, { option })
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant