brocessing / kirby-webpack

:muscle: A Kirby CMS starter-kit with modern frontend tools
MIT License
179 stars 23 forks source link

Update browsersync-update-content.js #68

Open benwest opened 3 years ago

benwest commented 3 years ago

The method of detecting the panel didn't work for me, maybe Kirby 3.5 broke it? This works.

antoine1000 commented 3 years ago

Hello @benwest,

Thanks for your interest in Kirby Webpack. Can you be more specific when you say "method of detecting the panel didn't work"? What didn't work exactly? The panel seems to work correctly on my side when I connect to localhost:8080/panel (with Kirby 3.5.3)

benwest commented 3 years ago

The panel would reload whenever the .lock file was written, because inPanel() === false.

benwest commented 3 years ago

I just did a fresh install of Kirby 3.5.1, went to /panel, pasted inPanel's definition into the console, and called it - false.

arnaudjuracek commented 3 years ago

The panel would reload whenever the .lock file was written, because inPanel() === false.

I got the same issue and your PR fixes it.

The only issue I see with your fix is if someone have a panel key in their global namespace, in which case the inPanel() function will cause a false positive.

benwest commented 3 years ago

True, neither method is ideal, but these are edge cases and I don’t think this way is any worse.

Speculatively what would be the clean/correct way to do this? A Kirby plugin?