agile-ts / agile Goto Github PK
View Code? Open in Web Editor NEW🌌 Global State and Logic Library for JavaScript/Typescript applications
Home Page: https://agile-ts.org
License: MIT License
🌌 Global State and Logic Library for JavaScript/Typescript applications
Home Page: https://agile-ts.org
License: MIT License
If we persist a Group, and than manually add a new ItemKey to it (in code), it overwrites this manually added ItemKey because it ovewrites it with the Storage value.
Not sure yet
It should merge the loaded value into the existing value, so that no ItemKey, that gets added after the first permantent save, gets missing.
Checkout the Examples of AgileTs
Job when Group value gets loaded from local storage
Initial Value that got added after the Group got persisted for the first time.
To be 90% sure that everything works in the @agile-ts/react package we should create jest tests for it.
Because as seen yesterday it doesn't work properly yet ^^
AgileHOC doesn't merge State Output into Class Component props
Should merge State Output into Class Component
https://codesandbox.io/s/agilehoc-example-1qdew?file=/src/RandomComponent.js
No
No
General Bug
Create function that gets triggerd if the Storage Value of a State got loaded.
The Copy method can't properly copy a plain class or an array/object of classes
Add Feature to Trigger a specific Callback in Event
For Instance:
MY_EVENT.on('error', (payload) => {console.log("Triggered Error")});
MY_EVENT.on('warning', (payload) => {console.log("Triggered Warning")});
MY_EVENT.on('success!', (payload) => {console.log("Triggered Success")});
MY_EVENT.trigger("success", {message: "blba"}); // success!
No
If you create a Collection you maybe want to directly add some intital Data
App.Collection({ initialData: [{id: 1, name: "frank"}] })
Currently functions like exists()
, is()
, .. can't get autodetected by the Computed Class since we don't track it.
Track each class that doesn't return this
, since it can influence the Computed Value
Because the Tests of this Framework are bad and depend on each other!
They work and are doing her job but they are not well written.
like ISSUE_TEMPLATE, ..
no
Allow the subscription to just the Group value and not the Group output.
// MyCompoent.tsx
const value = useValue(MY_GROUP);
console.log(value); // Returns [1, 2, 3, 4]
const output = useOutput(MY_GROUP);
console.log(output); // Returns [{id: 1, name: 'jeff', ..}]
no
Extract some utils
and the Logger Class
into separate packages.
Because we might use the Logger Class
as well in other packages and not only in the core.
The same counts for the utils.
So maybe extract these into two separate packages called:
@agile-ts/logger
@agile-ts/utils
This allows us to move a Item from one Group to another Group
MY_COLLECTION.move(1, 'group1', 'group2');
This moves the Item with the primaryKey 1 from group1 to group2
If you pass a Collection, thats value is not from type DefaultItem
into useAgile it complains, that
Collection<DefaultItem>
is not Collection<YourCustomInterface>
Issue is:
TS2769: No overload matches this call. Overload 1 of 2, '(deps: [] | (Observer<any> | State<any> | Collection<DefaultItem> | undefined)[], key?: string | number | undefined, agileInstance?: Agile | undefined): never[]', gave the following error. Argument of type 'Collection<collectionValueInterface>' is not assignable to parameter of type '[] | (Observer<any> | State<any> | Collection<DefaultItem> | undefined)[]'. Type 'Collection<collectionValueInterface>' is missing the following properties from type '(Observer<any> | State<any> | Collection<DefaultItem> | undefined)[]': length, pop, push, concat, and 28 more. Overload 2 of 2, '(dep: Observer<any> | State<any> | Collection<DefaultItem> | undefined, key?: string | number | undefined, agileInstance?: Agile | undefined): any', gave the following error. Argument of type 'Collection<collectionValueInterface>' is not assignable to parameter of type 'Observer<any> | State<any> | Collection<DefaultItem> | undefined'. Type 'Collection<collectionValueInterface>' is not assignable to type 'Collection<DefaultItem>'. Types of property 'data' are incompatible. Type '{ [key: string]: Item<collectionValueInterface>; }' is not assignable to type '{ [key: string]: Item<DefaultItem>; }'. Index signatures are incompatible. Type 'Item<collectionValueInterface>' is not assignable to type 'Item<DefaultItem>'. The types of 'observer.state().computeMethod' are incompatible between these types. Type 'ComputeMethod<collectionValueInterface> | undefined' is not assignable to type 'ComputeMethod<DefaultItem> | undefined'. Type 'ComputeMethod<collectionValueInterface>' is not assignable to type 'ComputeMethod<DefaultItem>'. Types of parameters 'value' and 'value' are incompatible. Type 'DefaultItem' is not assignable to type 'collectionValueInterface'.
It should be possible to pass a Collection
into useAgile
without any typeerror
See example
It can happen, that the 'rebuildStorageSideEffect' gets called before the the 'rebuildGroupSideEffect' than it stores the
not rebuild value..
Currently we are lucky, that the 'rebuildGroupSideEffects' got added before the 'rebuildStorageSideEffect'..
but that might not be always this way
See examples
Add a weight to the sideEffect, to see in which order it should get exectued!!
Maybe you don't want to save everything in one storage.. like the LocalStorage since it has a limited capacity..
If you store a Collection in an external Storage with some Items that were not initially added,
the Collection tries to rebuild the Group on each loaded Item when loading the Collection.
And since not every Item was loaded yet, a warning is printed that the Item doesn't exist in the Collection.
Shouldn't print warning and rebuild the whole Group when one Item was loaded
Related to issue:
#113
https://codesandbox.io/s/agilets-first-collection-uyi9g
When adding multiple Items to the TODO-List
and then refreshing the application.
You see the warning be printed, when the persisted value is loaded into the Collection.
Fix Group rebuilds #113
If you have a very very big Group and you mutate its value.. it rebuilds the whole Group output on a single change which might result in performance leaks.
Rebuild the Group only if the built output is needed.. for instance when calling output
, or items
bad performance
This package might than handle some Editor Stuff for example for Settings, ..
currently some packages are using yarn.lock some package.lock and some both
https://bundlephobia.com/result?p=@agile-ts/[email protected]
very big bundle size..
about 50kb
No
Outsource all log messages from the actual code.
pros:
cons:
Don't outsource all log messages from the actual code.
To be 90% sure that everything works in the @agile-ts/react package we should create jest tests for it.
https://discuss.circleci.com/t/command-jest-doesnt-get-executed-runs-endless/38731
In the dummy github-actions project its working quite fine.. ander there I am using nearly the same config.yaml
https://github.com/agile-ts/github-actions-test/blob/master/.circleci/config.yml
if you have a Item with the key '1' and a Item with the key '2'.
You can update the key of the second Item to '1' and than you have two Items with the same primaryKey!
It would be pretty cool if we could modify the selected Item of the Selector through the Selector.
MY_COLLECTION.collect({id: 1, name: 'hans'})
const MY_SELECTOR = MY_COLLECTION.createSelector("mySelector", 1);
MY_SELECTOR.patch({name: 'frank'});
MY_COLLECTION.getItemValue(1); // Returns' {id: 1, name: 'hans'}' but it would be cool if the value is now '{id: 1, name: 'frank'}'
Build a hook which wraps a proxy around the passed objects and tracks the used properties.
Only if a used property mutates the Component should rerender!
Something similar to:
https://github.com/avkonst/hookstate/blob/master/src/index.ts
but in a hook for AgileTs
No
A Vue Integration that allows a user to use AgileTs in a Vue 2.0 Project
No
Something like that
/**
* tagline.
*
* more description.
*
* Learn more: [link to documentation part]
*
* @param {object} x - description.
* @param {State} y - description.
* @returns {State} - description.
*
*/
function myCoolMethod() {
// xyz
}
No
Sometimes you don't know the to select Item yet,
but you need the Selector instance..
const MY_SELECTOR = USERS.createSelector('user', null);
no
Currently if you allow logging.. many things get logged..
maybe some configs for the logger might be useful.. like logCore, logEditor, logWhatever..
npms-analyzer doesn't detect readme in core
package since it analyzes the GitHub repository and not the actual npm build.
-> 0 point for the readme -> smaller search score
npms-analyzer detects the readme and gives us 0.6 points ;D
Create a fake readme with lorem ipsum,
in order to get the points.. since the readme will be added during the build process.
If you have a Collection and have an Item with the itemKey 0
..
it will have problems with this itemKey because we often do
if(!itemKey)
// ..
instead of
if(itemKey == null)
// ..
Shouldn't be a problem having an itemKey called 0
Software | Version(s) |
---|---|
@agile-ts/core | 0.0.15 |
No
Make the Computed Class accept an async compute method.
const MY_COMPUTED = App.createComputed(() => {
await xyz;
});
no
When we remove an Item that is currently selected by a Selector,
the remove method calls 'reselect' on the affected Selectors
to hold a reference to the now defunct Item. (-> Selector creates placeholder Item)
// ..
// Remove Item from Collection
delete this.data[itemKey];
// Reselect Item in Selectors (to create new dummyItem that holds reference)
for (const selectorKey in this.selectors) {
const selector = this.getSelector(selectorKey, { notExisting: true });
if (selector?.hasSelected(itemKey)) selector?.reselect({ force: true });
}
// ..
And when we now try to remove the placeholder Item,
it won't work because the Selector needs to hold a reference to it.
This is an expected behavior, but it shouldn't cause a rerender on each 'placeholder' Item remove try.
Doesn't remove required placeholder Item and create it again with a rerender as side effect.
// currently
MY_STATE.set(MY_STATE.value + 1);
// feature request
MY_STATE.set((value) => value + 1);
It would be pretty cool if we can just type npx create-react-app app-name --template agile
and have a base project with the core and stuff like that.
https://www.youtube.com/watch?v=m6hHfkOYYuw
like this
examples:
--- react
------ typescript
----------- class-component-example
----------- functional-component-example
----------- multieditor-example
------ javascript
----------- TODO
--- angular
------ TODO
You can test it with the code below.
There 'undefinedOrState' is typeof never but it should be the type (State | undefined)
// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-2-1.html
type AgileHookArrayType<T> = {
[K in keyof T]: T[K] extends State<infer U>
? U[]
: T[K] extends undefined
? undefined
: never;
};
class State<ValueType = any>{
public value: ValueType;
constructor(initialValue: ValueType){
this.value = initialValue;
}
}
// --- Testing of keyof ----------
interface Person {
name: string;
age: number;
location: string;
}
type x = keyof "test";
type y = keyof State;
type v = keyof Person;
// -------------------------------
export function useAgile<X extends Array<State | undefined>>(
deps: X | []
): AgileHookArrayType<X> {
return "" as any;
}
const state = new State<string>("text");
const undefinedOrState: State | undefined = Math.random() > 1 ? new State<number>(3) : undefined;
const [test, test2, test3] = useAgile([state, undefined, undefinedOrState]);
to work properly it needs these missing dependencies..
"dependencies": {
"typescript": "^4.2.3",
},
"devDependencies": {
"@types/react": "^17.0.3",
"@types/react-dom": "^17.0.3"
},
In addition we have to think about how to increase the dependency agile-ts version after each release
Currently nearly every method is public for a better testing purpose.. but it might decrease the user experiance..
Instead of having the property forceRerender..
it should have the property called 'force'
force = Create Job no matter what happens and not create Job and rerender no matter what happens
If it should rerender will be defined in the background property
-> if force & !background -> rerender and create job no matter what happens
-> if force & background -> don't rerender but create job
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.