Now one important note by the way you might be wondering why auto bind works here and project list even
though I didn't add import to the auto bind decorator.
Well because an apt Yes I have all these imports now actually if I removed these import stare which
would be correct because in here I technically only use to project Input Project listings on we'll have
a problem you see if does reloads we have an error here even though we get no compilation error unfortunately
but we get a runtime error so we need to make sure we import everything we use in a file into that file
to be safe.
Technically we can import everything an apt Yes and since Project input and project list which for example
used the auto bind decorator come later the order by decorator will be available when they need it.
But this is not the cleanest possible way.
If you instead import everything a file needs from inside that file you have to guarantee that this
file will have it available when it needs it and you are not relying on some global file which imports
everything where you then might remove an import and suddenly everything breaks.
So what's the solution here.
Well let's go back to the files and import what they need.
For example Project input does not just need the base component it also needs the validation logic and
order bind.
So in here I will import by going up one level with two dots from decorators the order bind decorator
whips like this.
And from you till the validation t s file that is definitely needed in this file here.
I also need the project state in here so I will import slash state project state yes and I will grab
these imports and go to project item and there I don't need the project state and validation so we can
remove that but we will need to order by and decorator we also need the Dragonball interface and the
project model so we'll also go to the models folder you're an import Project T S and drag dropped yes
in project list we won't need validation but I do need to project state in order bind.
And in addition from the models folder I need to project yes file and the drag drop test file with that
does safes and compiles and now it is all the works again as you see now we've got no runtime errors
because now we got all these imports back in the files so it is the proper way of doing it every file
specifies what it needs and we can split our code and still end up with one file so we get the best
of both worlds.
We could say yet this is not necessarily the best possible way of doing it.