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

Options hash is same instance passed to each cell when using collections #498

Open
samstickland opened this issue Jun 8, 2022 · 1 comment

Comments

@samstickland
Copy link

All,

Is this deliberate here?

cell = @cell_class.build(model, @options)

I would prefer this to be @options.clone, as we have some cells that can be passed options or use their own default values (which might be dependent on the model). As we mutate the cells options, the same options then get used in the next render from the collection.

FWIW, we only have this idea of default values for options, because there's no actual control over how a cell is built. Something to think about for v5 perhaps.

@apotonick
Copy link
Member

I think a quick solution would be to let Ruby do this by doing build(model, **options). In v5 we will enforce such an interface for constructors.

Ouch, that sounds like you had some fun figuring out why all collection items are rendered with the wrong options, or something along those lines? 😆

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