Skip to content

Fix resolveNestedRelations disabling during StoryblokClient init #844

Open
@edvinasjurele

Description

@edvinasjurele

Expected Behavior

Storyblok client is possible to initialize with resolveNestedRelations disabled.

Current Behavior

Initializing the Storyblok client with resolveNestedRelations flag disabled, does not correctly set the initial value

const Storyblok = new StoryblokClient({
  accessToken: '<TOKEN>',
  resolveNestedRelations: false,
});

Temporary workaround

Manually set flag AFTER the storyblok client initialization.

Storyblok.resolveNestedRelations = false;

Steps to Reproduce

https://runkit.com/embed/xx23fbgocz7c

Screenshot 2024-07-26 at 15 27 02

Potential defect

When passing resolveNestedRelations: false, as part of init object, the resolveNestedRelations should be set to false, but due to this.resolveNestedRelations = config.resolveNestedRelations || true in the

this.resolveNestedRelations = config.resolveNestedRelations || true
it is set to true for all falsey values including FALSE itself, as "false || true => true".

We might replace || with ??

image

Metadata

Metadata

Assignees

Labels

has-workaround[Issue] Temporary solutions available.p4-important[Priority] Violate documented behavior or significantly improve performance (priority)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions