-
-
Notifications
You must be signed in to change notification settings - Fork 229
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🔨 add empty arrays to the default grapher config (#4294)
Empty arrays are not currently included in Grapher's default config object that is derived from the schema. That's a bit of a foot gun, so I added them now. For context: When I implemented inheritance, I decided to keep empty arrays out of the default config since all defaults ended up in the `fullConfig` of each chart and that would have been unnecessarily verbose. But now that we're not doing that anymore, I can't think of a downside of also including the default values for arrays. This has two nice effects: - It used to be important that Grapher serialises empty arrays, so that a parent value can be overwritten with that empty array (e.g. if a parent has a related question that a child doesn't need). Now we can rely on these values being present in the default config. - Another nice effect is that we can simplify a number of tests like this one where `selectedEntityNames` was always serialised, even for an empty Grapher: https://github.com/owid/owid-grapher/blob/28ba2e4c036d0eb6156a4609add48f9e6077a764/packages/%40ourworldindata/grapher/src/core/Grapher.jsdom.test.ts#L92-L98
- Loading branch information
1 parent
2e6b62d
commit 0769513
Showing
7 changed files
with
36 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
// THIS IS A GENERATED FILE, DO NOT EDIT DIRECTLY | ||
|
||
// GENERATED BY devTools/schema/generate-default-object-from-schema.ts | ||
|
||
import { GrapherInterface } from "@ourworldindata/types" | ||
|
||
export const latestSchemaVersion = "{{LATEST_SCHEMA_VERSION}}" as const | ||
export const outdatedSchemaVersions = {{OUTDATED_SCHEMA_VERSIONS}} as const | ||
|
||
export const defaultGrapherConfig = {{DEFAULT_GRAPHER_CONFIG}} as GrapherInterface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters