opensearch-project / ml-commons-dashboards

User interface for the ml-commons plugin which can be integrated with OpenSearch Dashboards and a health dashboard for machine learning models.
Apache License 2.0
6 stars 20 forks source link

[PROPOSAL] Refactor useFetcher with data source id #316

Open wanglam opened 2 months ago

wanglam commented 2 months ago

What/Why

What are you proposing?

This issue is for proposing refactor useFetcher can be automatic reload after data source id change.

What users have asked for this feature?

315

What problems are you trying to solve?

After this refactor, we don't need to pass data source id from the page component side. It will be filled in the API side and automatic reload when using useFetcher after data source id change.

Any remaining open questions?

Sometimes, the params in useFetcher will be changed immediately when data source changed. It will send two requests, it is unnecessary. The useFetcher need to cancel previous request first.