Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

🐛 Fix poor merge behavior of Config + overrides #1519

Merged
merged 3 commits into from
Jul 30, 2024

Conversation

TheAfroOfDoom
Copy link
Contributor

@TheAfroOfDoom TheAfroOfDoom commented Jul 13, 2024

while working on #1517, i realized that if you specified an empty object for feature: {}, it would effectively delete all other env.feature config properties.

example:

const base = {
	env: {
		feature: {
			a: true,
			b: true,
		}
	}
}

const override = {
	env: {
		feature: {},
	}
}

const ans = ConfigService.merge(base, override)

// ans => `{ env: { feature: {} } }`

this is undesired behavior for a config system -- users should not need to specify every adjacent property to override a nested config setting


turns out there was an old FIXME to do this anyway. we have a core.merge method that behaves the way we want so I just hooked into it in this PR

@MulverineX MulverineX merged commit 1a469d7 into SpyglassMC:main Jul 30, 2024
3 checks passed
@TheAfroOfDoom TheAfroOfDoom deleted the fix-config-merge branch July 30, 2024 13:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants