question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

The view is not re-rendered on toolbar change

See original GitHub issue

Describe the bug I have created a new toolbar button following the steps in the documentation, the button is for localization change, the problem is that the story won’t re-render on globals change.

Expected behavior I expect the page reloads as language is changed as it is in your official storybook

I am using @ngx-translate/core for managing the translations.

export const globalTypes = {
  locale: {
    name: 'Locale',
    description: 'Internationalization locale',
    defaultValue: 'en',
    toolbar: {
      icon: 'globe',
      items: [
        { value: 'en', right: 'en', title: 'English' },
        { value: 'he', right: 'he', title: 'Hebrew' },
      ],
    },
  },
};
const withLocaleProvider = (storyFunc, { globals: { locale } }) => {
  const story = storyFunc();

  story.moduleMetadata.imports.push(
    TranslateModule.forRoot({
      defaultLanguage: locale,
      useDefaultLang: true,
      loader: {
        provide: TranslateLoader,
        useFactory: HttpLoaderFactory,
        deps: [HttpClient],
      },
    })
  );
  return story;
}

export const decorators = [
  withLocaleProvider,
];

System

  System:
    OS: Windows 10 10.0.19041
    CPU: (8) x64 Intel(R) Core(TM) i5-8265U CPU @ 1.60GHz 
  Binaries:
    Node: 12.18.3 - C:\Program Files\nodejs\node.EXE      
    npm: 6.14.6 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 87.0.4280.141
    Edge: Spartan (44.19041.423.0), Chromium (88.0.705.56)
  npmPackages:
    @storybook/addon-actions: ^6.1.15 => 6.1.15 
    @storybook/addon-essentials: ^6.1.15 => 6.1.15        
    @storybook/addon-links: ^6.1.15 => 6.1.15 
    @storybook/angular: ^6.1.15 => 6.1.15 

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:17 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
fabis94commented, Aug 26, 2021

The issue is still present, at least with Vue. The Vue component defined in the decorators array doesn’t receive the updated globals value until a re-render happens some other way like when switching to a different story or the Docs tab.

3reactions
bodograumanncommented, Feb 23, 2021

I noticed the same thing with vue. In the docs tab auto-reload works though.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to check if your component rerendered - and why!
To enable it, go to "Profiler" >> click the "Cog wheel" on the right side of the top bar >> "General" tab >>...
Read more >
screen not re-rendering after changing state - Stack Overflow
Update. Actually your app is working perfectly fine with me :/ Because you are not communicating the state change with the icon change....
Read more >
How to Update Data Without Rerendering an Entire Grid in ...
This blog explains how to enable immutable rendering mode in the Syncfusion Angular Data Grid control to effectively update data with code ...
Read more >
7 Rerendering Partial Page Content - Oracle Help Center
This chapter describes how to use the partial page render features provided with ADF Faces components to rerender areas of a page without...
Read more >
Toolbar for Blazor - DxToolbarItem is not re-rendered after the ...
This issue can be reproduced if DxToolbarItem.NavigateUrl depends on some property. In this case, changing the DxToolbarItem.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found