devvit icon indicating copy to clipboard operation
devvit copied to clipboard

Bug when calling Devvit.configure() more than once

Open Yay295 opened this issue 1 year ago • 1 comments

https://github.com/reddit/devvit/blob/67ca50a58c6bbc51f97d578be9257aaae4847f94/packages/public-api/src/devvit/Devvit.ts#L134-L176

If HTTP is enabled in the first call, then config will have http set to true. If you then try to disable HTTP with Devvit.configure({ http: false }), http will be set to false in config, but the plugin will not be un-this.use()d. It looks like the Reddit API is the only plugin that checks the config value instead of the existence of the plugin.

https://github.com/reddit/devvit/blob/67ca50a58c6bbc51f97d578be9257aaae4847f94/packages/public-api/src/devvit/Devvit.ts#L488

https://github.com/reddit/devvit/blob/67ca50a58c6bbc51f97d578be9257aaae4847f94/packages/public-api/src/devvit/Devvit.ts#L593-L595

Yay295 avatar Dec 16 '24 22:12 Yay295

Personally I don't think it should be possible to disable a plugin after it's been enabled. It could create hard to debug issues where you think you've enabled a plugin in one place but it's been disabled somewhere else.

Yay295 avatar Dec 17 '24 07:12 Yay295