Took a wild guess about what caused a bug just to find out you really fixed it without side effects? Tell us!
I work with WebComponents and currently the lifecycle methods are competing with class setters.
So it causes very unusual behaviour in child components by not-needed detach/re-attach of components.
I solved it with setTimeout and it works nicely without any side effect.
Following is the example component class:
export class MyComponent extends HTMLElement {
connectedCallback() {
super.connectedCallback();
this.render();
}
set data(value = {}) {
this._data = value;
this.render();
}
render() {
render(template(this._data), this);
}
}
Fixed the render method with following changes to render method:
render() {
clearTimeout(this.timeout);
this.timeout = setTimeout(() => {
render(template(this._data), this);
}, 100);
}
As this timeout of 100ms is unnoticed for used but for renders, it is a huge relaxation from frequent detach/re-attach.
Just within the last few weeks alone, I've experienced that over a dozen times.
Starting a one-year epic this week, with the goal of creating a product that brings in enough revenue to keep it afloat, it's amazing how many things I thought would be easy, but weren't, and how many more things I thought would be way too impossible to accomplish - but, totally the opposite.
An example was the authentication system I just created. Secure, with proper validation (using RegEx and other methods), properly modelled using roles and groups that went right into the refactoring of the app, then applying email validation, which then rolled into understanding how that worked as well as tightening up the processes involved, along with paying attention and minimizing the time it would take away from the user.
And, that's about a quarter of what needed to be understood and completed before Monday.
Well I was working for a startup as a front end developer . I received the task of addressing a bug which is about the navbar being not using the full width of the viewport as it should do .
<div class="container-fluid">
//stuff here
</div>
I worked on it as it contained the bootstrap framework removed the 'container-fluid' class and ta da......
I fixed the code without side effects and the code magically works fine .
I was migrating a MySQL database to MongoDB and on updating a nested object I really thought it'd need some iteration or at least another query but using $elemMatch, I made it work and I was like "Wow, it really worked".
Pankaj Patel
Blog, Tech, Photography etc.
Bridget Sarah
Full Stack Mobile App Developer
I went for a coding interview the other day, less to say, didn't go very well because i've been working with python and didn't realise it was so experimental with the language.
I wrote my own webscaper at the weekend and sure enough it worked! Then I started writing my own python mini cms and sure enough it's coming along, god only knows if it will work in the end but the code seems to be working!