slutske22 / react-esri-leaflet

react components for esri-leaflet
https://codesandbox.io/s/github/slutske22/react-esri-leaflet/tree/master/examples/ts
MIT License
37 stars 5 forks source link

this.leafletElement is undefined (v2) #13

Closed mohd-akram closed 2 years ago

mohd-akram commented 2 years ago

I get this error when using the library (see https://codesandbox.io/s/react-esri-leaflet-v2-forked-b7345). It seems to work fine with version 1.0.3, but every version after gives this error.

slutske22 commented 2 years ago

Interesting. I think I know what the issue is. Might take me some time to fix and test before I can publish an update. Are you not able to update your project to use react-leaflet v3? Would probably solve your problem much quicker and keep your project up to date...

mohd-akram commented 2 years ago

Not at the moment, we use several react-leaflet plugins and they don't all support v3. I'd use version 1.0.3 of this library in the meantime but there's an issue with its license.

mohd-akram commented 2 years ago

I just noticed that the license in npm (ISC) does not match the one in the repo (MIT and GPL previously). Would we be able to use the older version with the ISC license?

slutske22 commented 2 years ago

Yes, someone else had asked about that, that's why I changed the license. I love when people use my stuff, so I give you explicit permission to use 1.0.3 (or any version you like) with MIT....I'm not sure why npm is listing it as ISC. Is there a difference to you as far as ISC vs MIT? I'm not sure how to go back and change the license of a previous version, which is why I bumped it from 1.3.0 to 1.3.1. I'm still trying to isolate what change happened after 1.0.3 that is causing your problem...

mohd-akram commented 2 years ago

Thank you very much! MIT and ISC are essentially identical AFAIK. You'll have to change the license field in package.json to "MIT" and publish a new version for it to reflect in npm.

slutske22 commented 2 years ago

I just went back and publish a 1.0.4, which is essentially just 1.0.3, with the license changed to MIT. Here's a sandbox with that: https://codesandbox.io/s/react-esri-leaflet-v2-forked-pe7q8

Hopefully that gets your the latest features I had put in up to that point, with the license you need

I suspect the issue is actually in transpilation. It was at that point that I switched from a total babel-based approach, to one that mixes typescript tsc and babel. I was more focused on react-leaflet-v3 and esri-leaflet-v3 than keeping up to date with v2 of anything. Hopefully 1.0.4 gives you what you need. Keep me posted...I'm not sure I'm going to continue supporting v2 of anything in the future...

mohd-akram commented 2 years ago

That's perfect, thanks! I would hope support for v2 remains in some form, as v3 support is still not fully widespread with other plugins, and v3 of react-leaflet also uses a non-standard license (Hippocratic).

slutske22 commented 2 years ago

I can try to maintain both, but it gets pretty tricky when you're trying to import from react-leaflet v2 and react-leaflet v3 in the same codebase. I use the transform-rename-import babel plugin to get it done, but I guess its not working exactly as expected. Maybe I'll just keep support for RLV2 alive in a specific version. Thanks for using the plugin, LMK if you run into any other issues.