These are chat archives for ractivejs/ractive

28th
Feb 2018
Larry Osborn
@larryosborn
Feb 28 2018 01:54 UTC
I’m in the middle of updating a pretty large app with about a hundred components from v0.8 to v0.9. Unfortunately we made some liberal use of data that wasn’t isolated, and I’m trying to clean that up.
I love how { attributes: { required: [], optional: [] } } gives warnings when required attributes are missing. I wish if anything was in extra-attributes, that would also trigger a warning. Also, anything that is accessed that isn’t isolated trigger a warning.
Are there any features I can turn on or some tips for helping clean up my v0.8 mess?
Chris Reeves
@evs-chris
Feb 28 2018 01:56 UTC
warnAboutAmbiguity should help track isolation issues
Larry Osborn
@larryosborn
Feb 28 2018 01:56 UTC
I tried that but it seemed pretty noisy
But that is probably a good thing I guess
Chris Reeves
@evs-chris
Feb 28 2018 01:57 UTC
there's probably an event listener you could install on the root instance to catch stuff in extra attributes
Larry Osborn
@larryosborn
Feb 28 2018 02:02 UTC
That’s good, I can try that. Unfortunately most of my problem is not exlicitly binding the data to the child components. I guess I just have to really go through it all.
It will be better than last weeks chore of converting it all from coffee-script
Chris Reeves
@evs-chris
Feb 28 2018 02:06 UTC
eeeesh
here's an event listener that will log out extra attrs
Joseph
@fskreuz
Feb 28 2018 02:06 UTC
Hopefully TS won't be something we'll be running away from anytime soon :grin:
Larry Osborn
@larryosborn
Feb 28 2018 02:09 UTC
beautiful! thanks Chris
Chris Reeves
@evs-chris
Feb 28 2018 02:09 UTC
is turning off isolation an option for the immediate future, or are you trying to get everything up with best practices?
Larry Osborn
@larryosborn
Feb 28 2018 02:11 UTC
Best practices. We have about a dozen other internal apps all on 9, nice and up todate.
This one is just rather large and crusty
Chris Reeves
@evs-chris
Feb 28 2018 02:12 UTC
Ah. I feel your pain. I have a giant legacy app on 0.7 still waiting on a migration.
Larry Osborn
@larryosborn
Feb 28 2018 02:12 UTC
I turned isolated off and it works fine, but is a nightmare to navigate the code
this app’s first ractive version was 0.5.8, so it’s been quite a journey
Chris Reeves
@evs-chris
Feb 28 2018 02:17 UTC
if you don't mind using a custom build for a bit, it wouldn't be hard to put in a warning on implicit mapping
Larry Osborn
@larryosborn
Feb 28 2018 02:17 UTC
Sure I can do that
Chris Reeves
@evs-chris
Feb 28 2018 02:18 UTC
that's about where mine started too - prototype in 0.4, impl in 0.5
it's been fun
are you comfortable building, or would you like me to spin a build up for you real quick?
Larry Osborn
@larryosborn
Feb 28 2018 02:20 UTC
I haven’t built it before but it is probably pretty standard stuff? npm run build:local?
Chris Reeves
@evs-chris
Feb 28 2018 02:26 UTC
yep
here's the line that warns on implicit ambiguous mappings: https://github.com/ractivejs/ractive/blob/0.9/src/view/resolvers/resolveReference.js#L156
you can drop the conditional and leave warnAboutAmbiguity off to pin down implicit mappings from the template
Chris Reeves
@evs-chris
Feb 28 2018 02:31 UTC
and it looks like that covers this.get() from the api side too in 0.9
Larry Osborn
@larryosborn
Feb 28 2018 02:32 UTC
awesome, i’ll give that a try