Skip to content

Lazily load default controller#70

Merged
julianrubisch merged 1 commit into
stimulusreflex:masterfrom
rickychilcott:fix/lazily-load-default-controller
Nov 30, 2020
Merged

Lazily load default controller#70
julianrubisch merged 1 commit into
stimulusreflex:masterfrom
rickychilcott:fix/lazily-load-default-controller

Conversation

@rickychilcott

Copy link
Copy Markdown
Contributor

Bug fix

Description

This is a PR changes the way futurism's default_controller is resolved. Previously, you could only set as a constant (i.e. MyController), but now you can set as "MyController" and it will be converted to the constant upon use. This is to address a zietwork autoload issue as outlined in #68

NOTE: This is a commit that is based on #69 and shouldn't be merged until that PR is merged.

Fixes #68

Checklist

  • My code follows the style guidelines of this project
  • Checks (StandardRB & Prettier-Standard) are passing

@rickychilcott

Copy link
Copy Markdown
Contributor Author

@scottbarrow do you want to try this locally to see if it resolves your params AND controller loading issues?

@scottbarrow

Copy link
Copy Markdown
Contributor

@rickychilcott sorry for the delay, it does seem to fix the issue, however I have come across another issue that im not sure if its related.
in the locals hash, im passing in an array of 20 AR records, which seems to crash the signed_params message_verifier generator. @julianrubisch is there a limit to the size of the locals or the generated SGID?

Screen Shot 2020-10-19 at 11 12 28 AM

Screen Shot 2020-10-19 at 11 03 37 AM

Screen Shot 2020-10-19 at 11 13 45 AM

@rickychilcott

Copy link
Copy Markdown
Contributor Author

@scottbarrow I do think this is unrelated. @julianrubisch Have you experienced any issues with an exception raised from the message verifier?

https://api.rubyonrails.org/v6.0.3.3/classes/ActiveSupport/MessageVerifier.html doesn't mention any limit

@julianrubisch

Copy link
Copy Markdown
Contributor

Sorry for being unresponsive, too. I think the error message „singleton can’t be dumped“ points in another direction.

MessageVerifier uses Marshal which obviously doesn’t allow serializing of Singletons:

http://www.asherkory.com/Singletons-and-Caching/

https://stackoverflow.com/questions/31291363/singleton-cant-be-dumped-cached-resource-gem

@scottbarrow

Copy link
Copy Markdown
Contributor

Hey guys, has there been any progress on this, currently we're not able to implement futurism due to this and the params issue reported, please let me know how I can help out

@rickychilcott

rickychilcott commented Nov 6, 2020 via email

Copy link
Copy Markdown
Contributor Author

@julianrubisch

Copy link
Copy Markdown
Contributor

Hey @scottbarrow sorry for the delay, it has been quite a month here, too.

The problem I see here is one of reproduction. I easily futurize > 20 AR on a regular basis - also because futurism actually splits that up into multiple placeholders anyway. GlobalID would theoretically support locate_many, but we haven’t incorporated that yet.

So I fear it’s your turn to provide us with an MVCE :-(

@rickychilcott

Copy link
Copy Markdown
Contributor Author

Once #69 is merged, I can rework this PR to be just the appropriate pieces and try to get this ready to be reviewed.

@julianrubisch

Copy link
Copy Markdown
Contributor

Please rebase!

@rickychilcott rickychilcott force-pushed the fix/lazily-load-default-controller branch from 5c545eb to 9d976e2 Compare November 29, 2020 17:24
@rickychilcott

Copy link
Copy Markdown
Contributor Author

Done!

@julianrubisch

Copy link
Copy Markdown
Contributor

Is it ready to be tested, then?

@rickychilcott

Copy link
Copy Markdown
Contributor Author

Yep. It should be ready to be tested and for prime time. I tested it manually, and have some tests in place to ensure the setter is used appropriately.

@julianrubisch

Copy link
Copy Markdown
Contributor

Great, will put it through the paces tomorrow... don’t see any blockers though

@julianrubisch julianrubisch merged commit f0fa0f3 into stimulusreflex:master Nov 30, 2020
@julianrubisch

julianrubisch commented Nov 30, 2020

Copy link
Copy Markdown
Contributor

Works as advertised, thanks!

Just a semver question: given that we change the semantics of how to specify the default_controller, this should "at least" be a minor version bump, correct?

@rickychilcott

Copy link
Copy Markdown
Contributor Author

Good question on the version number. Since it won't break if they made it an actual class name versus a string -- I think it'd be ok to release as just a patch, but the recommendation is now to set it as a string. Since this is a non-breaking change, I don't see the need to do a minor bump, but it might communicate "hey something more significant has changed about this gem".

Up to you.

@julianrubisch

Copy link
Copy Markdown
Contributor

Ah, because of .to_s.constantize... gotcha 👍🏻

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.

Overriding the controller

3 participants