Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 08 08:40
    papandreou commented #784
  • Sep 08 08:09
    pingvinen commented #784
  • Aug 22 05:39

    papandreou on master

    13.0.1 (compare)

  • Aug 22 05:39

    papandreou on v13.0.1

    (compare)

  • Aug 22 05:34

    papandreou on toSatisfyUndefinedProp

    (compare)

  • Aug 22 05:34

    papandreou on master

    Fix bug that caused expect({foo… Merge pull request #852 from un… (compare)

  • Aug 22 05:34
    papandreou closed #852
  • Aug 20 14:06
    papandreou assigned #852
  • Aug 20 14:06
    papandreou opened #852
  • Aug 20 14:05

    papandreou on toSatisfyUndefinedProp

    Fix bug that caused expect({foo… (compare)

  • Jul 09 14:26

    papandreou on master

    Fix CHANGELOG generation in pre… (compare)

  • Jun 05 12:09

    papandreou on master

    Unskip test that succeeds now w… (compare)

  • May 31 05:48
    papandreou synchronize #784
  • May 31 05:47

    papandreou on camelCase

    Sketch out some basic tests Slow, naive implementation of t… Support camel case syntax withi… and 16 more (compare)

  • May 31 05:41

    papandreou on master

    Fix typos in test descriptions (compare)

  • May 31 05:28
    papandreou synchronize #784
  • May 31 05:28

    papandreou on camelCase

    Clean (compare)

  • May 30 22:10
    papandreou synchronize #784
  • May 30 22:10

    papandreou on camelCase

    simplify (compare)

  • May 30 21:42
    papandreou synchronize #784
Joel Mukuthu
@joelmukuthu
I went to verify if there was a way types-as-comments supported generics, and my search led me here https://github.com/tc39/proposal-type-annotations. It's still pretty early stage but what do you think?
Gustav Nikolaj
@gustavnikolaj
If I understood and remember correctly, the tc39 proposal is only about extending the syntax to allow for types between : and = in const foo: string = “foobar”; and a interface structure as well.
So there’s space for different implementations on top of that.
Gustav Nikolaj
@gustavnikolaj
FWIW I found the solution to my problems with cra/ts and storybook. It turns out that the issue was a bad interaction between npm v8 and storybook. Storybook dependent on the old peerDependency functionality from npm v7 and older, and it caused it to break for me. It's reported here and there's a workaround, and a promise of a fix for the next major version: storybookjs/storybook#18298
Sune Simonsen
@sunesimonsen

New Dependable State with types and API docs :love_letter:
https://dependable-state-api.surge.sh/modules/state.html

I'll update dependable view with the same kind of types and docs when I have some time.

Sune Simonsen
@sunesimonsen
Screenshot 2022-06-20 at 16.29.47.png
Gustav Nikolaj
@gustavnikolaj
Looking very nice!!
Sune Simonsen
@sunesimonsen
Thanks
Sune Simonsen
@sunesimonsen

TodoMVC (source) running on @dependable/view
New API docs and types.

Don't know if the types will actually work with TypeScript - haven't made an example yet.

Gustav Nikolaj
@gustavnikolaj
  1. Why is the api functions wrapped in an observable? https://github.com/sunesimonsen/dependable-example-todomvc/blob/main/public/model.js#L4
  2. You use the module system to access a singleton state object. Would this also be your preferred solution in a real app? https://github.com/sunesimonsen/dependable-example-todomvc/blob/main/public/components/TodoList.js
Sune Simonsen
@sunesimonsen
I'm trying to figure that out, but this gives me a very easy way of mocking the api, I just replace it.

You use the module system to access a singleton state object. Would this also be your preferred solution in a real app?

Yes - I think most application state is global and can be modelled as a global state in a declarative way.

Gustav Nikolaj
@gustavnikolaj
I try to avoid having the state in a global singleton as I find it makes it pretty hard to mock in tests
3 . Is babel required for this to work?
Sune Simonsen
@sunesimonsen

3 . Is babel required for this to work?

No, I just use it to transpile htm out of the picture.

Gustav Nikolaj
@gustavnikolaj
So it could be a production only step
Looking good :)
I think I might opt to pass more things around as props, but there's nothing preventing me from doing that.
Sune Simonsen
@sunesimonsen

I try to avoid having the state in a global singleton as I find it makes it pretty hard to mock in tests

You would think so, but I'm using https://www.apollographql.com/docs/react/local-state/reactive-variables/ at work and we just set the state before the test and it works really well :-)

I think I might opt to pass more things around as props, but there's nothing preventing me from doing that.

That is really no reason and it makes for more re-rendering. Using the observables and computeds directly only re-renders components that is actually affected.

I'm adding tests to the example now, so you can see how that looks afterwards
Gustav Nikolaj
@gustavnikolaj
I might have to give it a shot. My gut-feeling is very much opposed to it, but I cannot find any reasonable arguments for why it shouldn't be all right. It's not like we're ever going to have more than one UI rendering at the same time from the same browser :)
Looking forward to the test examples <3
Sune Simonsen
@sunesimonsen

going to have more than one UI rendering at the same time from the same browser

what you might run into is that you need more instances of something, but they you will just have global state holding models for those. Similar to how I have a lists of todo classes in an observable. .

Gustav Nikolaj
@gustavnikolaj
It means that the components are very closely tied to that global state model, rather than having props as interface. But yeah, I get your point. Realistically, most things aren't really ever going to be used outside that initial place.
Just noticed something weird.
  1. Add a todo item "foo"
  2. Add a todo item "bar"
  3. With the cursor in the todo input field, press TAB then SPACE

Expected: I can see a focus indicator, and the first item would be selected, and completed when space is selected|

Actual: No focus indicator, both items are completed

Sune Simonsen
@sunesimonsen
Yes I expect the example to be a bit bugging - slammed it together really quickly - I'll come back and brush of things.
Example of a simple state test, if you are curious:
import {
  allTodos,
  createTodo,
  visibilityFilter,
  visibleTodos,
  Todo,
} from "../public/model.js";

import unexpected from "unexpected";
import unexpectedDependable from "unexpected-dependable";

const expect = unexpected.clone().use(unexpectedDependable);

describe("visibleTodos", () => {
  describe("with an empty list of todos", () => {
    beforeEach(() => {
      allTodos([]);
    });

    it("returns an empty array", () => {
      expect(visibleTodos(), "to equal", []);
    });
  });

  describe("with list of todos that is all completed", () => {
    beforeEach(() => {
      allTodos([
        new Todo({ id: 0, text: "By milk", completed: true }),
        new Todo({ id: 1, text: "Paint the fence", completed: true }),
        new Todo({ id: 2, text: "Mow the lawn", completed: true }),
      ]);
    });

    describe("and the visibility filter is active", () => {
      beforeEach(() => {
        visibilityFilter("active");
      });

      it("returns an empty array", () => {
        expect(visibleTodos(), "to equal", []);
      });
    });
  });
});
Sune Simonsen
@sunesimonsen

Just noticed something weird.

  1. Add a todo item "foo"
  2. Add a todo item "bar"
  3. With the cursor in the todo input field, press TAB then SPACE

This is because you hit the toggle all first then the checkboxes - I'll fix up focus when I have a bit of time.

Haha okay the official ones also does that :wat:
Gustav Nikolaj
@gustavnikolaj
At least it's consistent :D
That's not how I would expect it to work, but I must be mistaken :D
Sune Simonsen
@sunesimonsen
Haha no - that seems pretty broken
Also no focus styling :sweat_smile:
Sune Simonsen
@sunesimonsen

@gustavnikolaj haha I guess somebody fix the focus styling in the latest version of the TodoMVC styles https://dependable-example-todomvc.surge.sh/

Maybe they went a bit over the top :sweat_smile:

Gustav Nikolaj
@gustavnikolaj
That "v" / downwards caret button is very surprising to me
Sune Simonsen
@sunesimonsen
Yes that has been there all along
Gustav Nikolaj
@gustavnikolaj
I didn't notice it at all before, and I don't know why you would ever want it
:D
Sune Simonsen
@sunesimonsen
Mhh I think they broke backward compatibility a bit :-)
Nahh that was just me breaking things.
Peter Müller
@Munter
Are any of you planning on seeing some of the tour in the city tomorrow? I was thinking of finding some place near the city center and bring a camera, possibly have a beer
Peter Müller
@Munter
Looks like i won't be able to be in the city after all. I'll have to watch on TV like everyone else :)
Gustav Nikolaj
@gustavnikolaj
Hehe... I don't think you go to the city today. Either you are there already, or you'll not be able to get there :D
Peter Müller
@Munter
What's a good library to use to get stable cache keys from json objects?
Andreas Lind
@papandreou
You mean sort of like crc16(JSON.stringify(obj))?
But probably shouldn't care about the key definition order?
Peter Müller
@Munter
We might have keys in different order, and those should hash to the same if the values don't change