Currently, resession integration is a bit incomplete since the state.load_all function does not set the __resolver metadata in the scope_state metatables. This causes nil index errors when trying to call require("grapple").reset().
The solution implemented here allows for an optional scope_resolver (which defaults to settings.scope to be passed into load_all, which is then used to set all the __resolver metadata. This ensures that the __resolver metadata is set, avoiding the nil index errors.
I also changed the behavior of ensure_loaded so that it always overrides and sets the __resolver metadata. Before, it would just return and do nothing if the scope_state was not empty, which intuitively doesn't really make much since because it isn't really "ensuring" that the scope_resolver is always being set. This alone is actually sufficient to fix the resession integration issues, but I still think the changes made in 1) are reasonable (though not really necessary).
A brief comment: I'm not sure if this project is still being maintained or if you'll ever read this, but on the off chance you do, I just wanted to thank you for all the hard work you've put into grapple. I truly think it's the best at what it does despite being heavily underrated (though I do know many people who prefer using it over harpoon). Your dedication to this project shows in its quality, and I along with many people are truly grateful for this amazing plugin you've contributed. Thanks!
Currently, resession integration is a bit incomplete since the
state.load_all
function does not set the __resolver metadata in thescope_state
metatables. This causes nil index errors when trying to callrequire("grapple").reset()
.The solution implemented here allows for an optional scope_resolver (which defaults to
settings.scope
to be passed intoload_all
, which is then used to set all the__resolver
metadata. This ensures that the__resolver
metadata is set, avoiding the nil index errors.I also changed the behavior of
ensure_loaded
so that it always overrides and sets the__resolver
metadata. Before, it would just return and do nothing if thescope_state
was not empty, which intuitively doesn't really make much since because it isn't really "ensuring" that the scope_resolver is always being set. This alone is actually sufficient to fix the resession integration issues, but I still think the changes made in 1) are reasonable (though not really necessary).A brief comment: I'm not sure if this project is still being maintained or if you'll ever read this, but on the off chance you do, I just wanted to thank you for all the hard work you've put into grapple. I truly think it's the best at what it does despite being heavily underrated (though I do know many people who prefer using it over harpoon). Your dedication to this project shows in its quality, and I along with many people are truly grateful for this amazing plugin you've contributed. Thanks!