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

Stepper update to drop length/index props #222

Closed
endigo9740 opened this issue Sep 13, 2022 · 4 comments
Closed

Stepper update to drop length/index props #222

endigo9740 opened this issue Sep 13, 2022 · 4 comments
Assignees
Labels
enhancement New feature or request help wanted Extra attention is needed

Comments

@endigo9740
Copy link
Contributor

We had a great suggestion on the Svelte support section that explained how we can build the child count (length prop) and child index values (index props) into the components to be automatically generated and maintained.

Here's a basic proof of concept:
https://svelte.dev/repl/e2ca4f024dfa482f9715edab4f67b677?version=3.50.1

Here's a more advanced version that allows for children to be added/removed dynamically:
https://svelte.dev/repl/d5d784109e2145dd8f41906e16bfb89a?version=3.50.1

Unfortunately these seem subject to the same Vite HMR (hot module reload) issue that our Code Block is. When code is modified in the Step component the index values get multiplied. However, if we can work around this, it would make the Stepper MUCH easier for end users to implement.

@endigo9740 endigo9740 self-assigned this Sep 13, 2022
@endigo9740 endigo9740 added the enhancement New feature or request label Sep 13, 2022
@endigo9740 endigo9740 removed their assignment Sep 26, 2022
@endigo9740 endigo9740 added the help wanted Extra attention is needed label Sep 26, 2022
@Sarenor
Copy link
Contributor

Sarenor commented Sep 28, 2022

Trying to take care of this :)

@endigo9740
Copy link
Contributor Author

Assigned!

@endigo9740
Copy link
Contributor Author

See also: #332

@endigo9740
Copy link
Contributor Author

@Sarenor So I spent some time testing this today. Unfortunately, as cool as the "self register" method is per the REPLs above, this method is just too slow for a real world use case. Even stripped down to the basics, there's visually noticeable delay while the setup process occurs.

stepper-test

Plus, in additional to the visual delay, you also get issues with the HMR of Vite where the child indexes start duplicating. This requires a hard refresh on the page to correct. Here's what that looks like. Note I have 3 children, but 6 items registered in the $children store. If I continued to make changes in the Step component these would continue to duplicate forever!

Screen Shot 2022-10-09 at 1 01 03 PM

Given this, I think our current implementation is going to be the best we can do for the moment. At least until another technique for handling this is found. To be honest, it's annoying having to supply values manually, but it's not the end of the world. If people want to use this component, they will.

I think with this I'm going to close out this issue and the PR. Though they'll remain archived if we need to refer to them in the future. Thanks for your help on testing this one and sorry this hasn't worked out. Sometimes that's how it goes!

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

No branches or pull requests

2 participants