This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// We've been working for a full day hunting down why AngularJS 1.5 retains large data sets after a component is removed. | |
// We don't know the exact cause, since there are many parts involved. | |
// But jQuery cache, $scope.$$watchers, $transclude all seems to be different players in this issue. | |
// We provided a super large data (used about 1GB+ of memory) to a sub component in our template. | |
// But when resetting the component to apply new data instead of using the same amount, | |
// the memory doubled until the new component was rendered and Angular eventually cleared the scoped. | |
// Since this ended up using almost 3GB it crashed Chrome for our users. | |
// After testing everything trying to clean our objects it was still an issue since the data was references in so many places by Angular. | |
// Our solution was to thoroughly clean all child scopes for our destroyed component by deleting all watchers, all non-angular props, | |
// and if those props where objects, also delete those sub props in case other references to t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Move/rename any file and keep git history | |
git filter-branch --index-filter 'git ls-files -s | sed "s|[old_path]|[new_path]|g" | | |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ | |
git update-index --index-info && | |
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' [first_commit_hash]..HEAD | |
# Example | |
git filter-branch --index-filter 'git ls-files -s | sed "s|packages/web-app|packages/web-app-new|g" | | |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ | |
git update-index --index-info && |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git filter-branch --index-filter 'git ls-files -s | sed "s-\t\"*-&[INSERT_PATH_HERE]/-" | | |
GIT_INDEX_FILE=$GIT_INDEX_FILE.new \ | |
git update-index --index-info && | |
mv "$GIT_INDEX_FILE.new" "$GIT_INDEX_FILE"' [INSERT_COMMIT_HASH_HERE]..HEAD |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* This script bundles d.ts files generated by typescript compiler and your own d.ts files. | |
* The reason for the need of copying your own d.ts is that tsc won't generate typings for files with only types/interfaces, | |
* hence they won't end up in the declaration folder. | |
* | |
* Specify typings in package.json | |
* "types": "dist/index.d.ts" | |
* | |
* Set the following props in tsconfig.json under "compilerOptions": | |
* "declaration": true, |