Skip to content

Conversation

@mykalmax
Copy link
Member

@mykalmax mykalmax commented Feb 8, 2023

No description provided.

@mykalmax mykalmax marked this pull request as ready for review February 9, 2023 22:17
@mykalmax mykalmax requested a review from vchan February 9, 2023 22:18
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why is there so much boiler plate here? is there a library we could use for what you're trying to do?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here, what's all this boiler plate

cc @vchan

Copy link
Contributor

@vchan vchan Feb 9, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have an object which keeps track of state in the app. All this boilerplate code pulls fields out of the state object that this component needs. The reason we don't just have const state = useStorePlan() and use state.plan or state.environment everywhere is because it might trigger unnecessary re-renders when something else in the state that this component doesn't care about changes.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are using library for shared state , here is example from their docs https://github.com/pmndrs/zustand/blob/main/docs/guides/slices-pattern.md#usage-in-a-react-component

So another problem is that component is big and need some refactoring and splitting into smaller chunks. it will reduce number of state a bit

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Want to confirm it should be model_name and not modelName.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we are getting that value from API (type ContextEnvironmentBackfill) and using as is

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should category have a type here? Category?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is inferred

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is inferred from client.ts

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typing?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is inferred from client.ts

@mykalmax mykalmax force-pushed the max/ui_fix_type_for_planStore branch from c93ca8b to cda54c5 Compare February 10, 2023 19:21
@mykalmax mykalmax requested a review from vchan February 10, 2023 19:29
@mykalmax mykalmax merged commit ac378c5 into main Feb 10, 2023
@mykalmax mykalmax deleted the max/ui_fix_type_for_planStore branch February 10, 2023 21:09
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

Successfully merging this pull request may close these issues.

5 participants