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.

A "on story change" type of feature

See original GitHub issue

Is your feature request related to a problem? Please describe. I had to build a feature that is responsive to browser size change, so I had to do

        $("html").width("100%");
	$("html").height("100%");
	$("body").width("100%");
	$("body").height("100%");
	$("#root").width("100%");
	$("#root").height("100%");

so that the subsequent rendered components would be able to do the same and change size via simple css. I know that there are viewport feature, maybe I was just doing it wrong, but didn’t see the same, probably the only viable, effect as my code did.

I need the feature so that I could remove these CSS rules to prevent possible effect on other and future features.

Describe the solution you’d like A hook that can do “on story change run this function”. Maybe it could be the third argument for .add in storiesOf(“something”, module).add(“name”, component, onChangeFunction). The onChangeFunction would be where I’d write my custom function.

Basically a mimic of “onComponentDismount”.

Describe alternatives you’ve considered personally, making the iframe html to be 100% for width and height could work for me.

I could see that others may have better use of my requested feature though.

Are you able to assist bring the feature to reality? nope

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
dperetticommented, Feb 13, 2022

You can achieve build up / tear down like this:

// in preview.ts
export const decorators = [
  (story) => {
    useEffect(() => {
      // build up
      return () => {
        // tear down
      }
    }, [])
    return story()
  },
]
1reaction
fredrikbergqvistcommented, Jan 1, 2020

@shilman Alright, I guess a global decorator is the way to solve this then instead of a “build up/tear down”-pattern. Thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Link stories to custom issue type "Feature"
We have created a custom issue type, Feature, that is bigger than stories, smaller than epics. We use epic link to link features...
Read more >
change type from user stories to feature - rally - Stack Overflow
I use query to get the type, but I don't know how to change it. query.query_string = "(FormattedID = \"US4332\")". results = @rally.find(query)....
Read more >
Instagram: Here's How to Use the New Type Mode in Stories
Instagram recently launched a new Type mode in Stories, allowing users to share Story posts containing text on colorful backgrounds, ...
Read more >
Using the Convert option | Rally Software
If I use this option to convert a feature to a capability, ... fields other than Portfolio Item Type, you cannot convert a...
Read more >
When changing work item type from Task to User Story, the ...
Change type to User Story and Save; Notice that the Original Estimate is still 1. I don't think estimates should be attached to...
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