by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jul 07 13:21
    euaaaio ready_for_review #71
  • Jul 06 16:30
    euaaaio edited #71
  • Jul 06 12:52
    euaaaio synchronize #71
  • Jul 03 11:17
    euaaaio edited #71
  • Jul 03 11:16
    euaaaio synchronize #71
  • Jun 30 12:21
    euaaaio edited #71
  • Jun 30 12:11
    euaaaio synchronize #71
  • Jun 30 12:00
    euaaaio synchronize #71
  • Jun 30 11:45
    euaaaio synchronize #71
  • Jun 27 19:20
    ai commented #71
  • Jun 27 17:20
    euaaaio edited #71
  • Jun 27 15:49
    euaaaio synchronize #71
  • Jun 27 15:48
    euaaaio synchronize #71
  • Jun 27 15:35
    euaaaio opened #71
  • Jun 23 23:00

    ai on master

    Remove any color library (compare)

  • Jun 21 03:25

    ai on master

    Fix headers example Update dependencies (compare)

  • Jun 18 20:39

    ai on master

    Use kleur instead of chalk Replace chalk to kleur (compare)

  • Jun 15 14:17
    ai commented #70
  • Jun 15 14:17

    ai on master

    Update replace-vuex.md (#70) (compare)

  • Jun 15 14:17
    ai closed #70
Illia Osmanov
@ilajosmanov

channels() { return ['hardware/all'] },
It's does not work((

If I want to render my items — I need write the next code:

channels() { return ["hardware"] }
Andrey Sitnik
@ai
because mutation !== channel
you should have hardware mutation
hardware/all is a channel, not a action/mutation
Illia Osmanov
@ilajosmanov
Error on Logux server:
Wrong channel name hardware
Uncaught (in promise) Error: Server undid Logux action because of wrongChannel
Andrey Sitnik
@ai
let’s go to the private messages and describe in Russian :)
Illia Osmanov
@ilajosmanov
:D
To twitter?
Andrey Sitnik
@ai
Look ate the Gitter sidebar, there is a private chat with me
I already sent you a few messages
cosminv6u
@cosminv6u

I have an error after upgrading to the latest versions of Logux Vuex & Client.

When doing this:

    badge(this.store.client, { messages: badgeEn, styles: badgeStyles })
    log(this.store.client)

The error is:

Argument of type 'CrossTabClient' is not assignable to parameter of type 'Client<{}, Log<ClientMeta, LogStore>>'.
  The types of 'options.server' are incompatible between these types.
    Type 'string | import("c:/java_dev/s4m/dtsplus-ui/node_modules/@logux/core/base-node/index").Connection' is not assignable to type 'string | import("c:/java_dev/s4m/dtsplus-ui/node_modules/@logux/client/node_modules/@logux/core/base-node/index").Connection'.
      Type 'Connection' is not assignable to type 'string | Connection'.
        Type 'import("c:/java_dev/s4m/dtsplus-ui/node_modules/@logux/core/base-node/index").Connection' is not assignable to type 'import("c:/java_dev/s4m/dtsplus-ui/node_modules/@logux/client/node_modules/@logux/core/base-node/index").Connection'.
          Types of property 'on' are incompatible.
            Type '(event: "connect" | "error" | "connecting" | "disconnect" | "message", listener: () => void) => Unsubscribe' is not assignable to type '{ (event: "connect" | "connecting" | "disconnect", listener: () => void): Unsubscribe; (event: "error", listener: (error: Error) => void): Unsubscribe; (event: "message", listener: (msg: Message) => void): Unsubscribe; (event: "disconnect", listener: (reason: string) => void): Unsubscribe; }'.
              Types of parameters 'listener' and 'listener' are incompatible.ts(2345)

It works in
"@logux/client": "^0.8.4",
"@logux/vuex": "^0.3.1"
, but not in
"@logux/client": "^0.9.0",
"@logux/vuex": "^0.6.1"

Eduard Aksamitov
@euaaaio
Oh, my mistake. Just install logux/vuex#next from GitHub.
I'll release next version with updated client soon.
cosminv6u
@cosminv6u
ok 10x
Illia Osmanov
@ilajosmanov
Hey! I have the next task: form for create article. In this form also I can create some tags for article immediately. So, when I create tag I will get id from this tag and attach to article. How solve this problem when need create article and tag in offline mode?
Andrey Sitnik
@ai
@ilajosmanov use client-side random ID. For instance, UUID or https://github.com/ai/nanoid/
Illia Osmanov
@ilajosmanov
Yes, I know this library. Very cool. So on BE side I using mongo. I should use id which generate nanoid for me? Not mongo ids?
All my data base on client ids, right?
Andrey Sitnik
@ai
yeap
Illia Osmanov
@ilajosmanov
cool, thanks
I was just thinking of using this library
Стас Далинин
@kirpich634_gitlab

Привет, я хочу использовать @logux/redux в моем react native приложении, но как только я импортирую createLoguxCreator из библиотеки, появляется вот такая ошибка:

Error: React Native does not have a built-in secure random generator. If you don’t need unpredictable IDs use nanoid/non-secure. For secure IDs, import react-native-get-random-values before Nano ID. If you use Expo, install expo-random and use nanoid/async.

Что вы используете в пакете, что может быть с этим связано ?
В файле create-logux-creator/index.js я не вижу ничего похожего на то что могло бы такое вызвать

16 replies
Illia Osmanov
@ilajosmanov
Hey! How you test mocks response from DB (ex. Mongo) when you need testing channels and types?
1 reply
Стас Далинин
@kirpich634_gitlab
Привет, почему в Client options userId is required ?
Я хочу сделать авторизацию и работу полностью через logux, но меня не устраивает рецепт изложенный на сайте, я планировал делать всё через одно подключение, это неправильно ? Если да почему ?
Что мне нужно гуглить чтобы понять это ?
Почему нужно делать переподключение при смене userId https://logux.io/redux-api/#client-changeuser ?
21 replies
Illia Osmanov
@ilajosmanov

@ai Интересный баг нашел.
У меня есть .channel, который читает из mongodb данные. Есть .type, который пишет в этот же документ.

Если в тестах я пишу вот так:

await client1.process(createHardware(doc));
await client2.subscribe("@hardware")

у меня вылетает ошибка:

RangeError: Maximum call stack size exceeded

      at clone (node_modules/@logux/core/test-pair/index.cjs:3:16)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at node_modules/@logux/core/test-pair/index.cjs:5:25
          at Array.map (<anonymous>)
      at clone (node_modules/@logux/core/test-pair/index.cjs:5:16)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at node_modules/@logux/core/test-pair/index.cjs:5:25
          at Array.map (<anonymous>)
      at clone (node_modules/@logux/core/test-pair/index.cjs:5:16)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at clone (node_modules/@logux/core/test-pair/index.cjs:9:19)
      at node_modules/@logux/core/test-pair/index.cjs:5:25
          at Array.map (<anonymous>)
      at clone (node_modules/@logux/core/test-pair/index.cjs:5:16)
3 replies
если я напишу сначала подписку, а потом экшн — ошибки нет
Andrey Sitnik
@ai
@ilajosmanov @kirpich634_gitlab давайте не писать по русски в этом чате. Если лень переводить на английский — пишите в личку.
Illia Osmanov
@ilajosmanov
Oh, right. Sorry
So, I have the error when calling process and then subscribe on the channel
But if I switch (first a channel and second process) — have no error
Andrey Sitnik
@ai
yeap, create an issue
Illia Osmanov
@ilajosmanov
I using typescript. What can I return if I cannot find a document? Just throw Error?
33 replies
cosminv6u
@cosminv6u

Hello,

I want to use Logux at work and I have some questions about the best practices.
Up until now I played with Logux testing various scenarios, but now I want to use it for real.

My usecase:

I have a list of car stores that's displayed in the screen (paginated, sortable, filterable).

The list is populated at first via Excel File Upload.

After that you can retrieve all stores, change various fileds of a store, delete one, delete all.

My Questions:

  1. Should I use Logux for FileUpload? Or just REST? [I'd say no]
  2. Should I use Logux for retrieving the list (findAll)? Or just REST? [I'd say no]
  3. Should I only use Logux for updating/deleting one Store, nothing more? [I'd say yes]
  4. Should I send 1 Logux action per each field of the store that is changed? Or send all fields at once in 1 Logux action? [I'd say 1 action per field]
  5. We have a Java + Spring Boot + Axon Backend.
    Now we use Logux Proxy which calls a REST Endpoint in Spring (created by me), then this Endpoint sends Axon Commands.
    Could we skip the Logux Proxy and have the Logux Vuejs or Logux Vuex talk directly to Axon? Knowing that both Logux and Axon implement CQRS?
21 replies
Piotr Mikołajek
@pmikolajek

Hello. First off, amazing project. The entire offline-first, optimistic UI approach is, frankly, awe-inspiring.

I have a question regarding your suggestion for server-side actions from a few days ago. This one:

  async load (ctx) {
    let messages = db.findMessages({ room: ctx.id })
    return messages.map(i => [{ type: 'message', text: i.text, authorId: i.authorId, room: i.room }, { time: i.createdAt }])
  }

I've added something similar to my project, but the problem is that the ordering of actions with identical timestamps is non-deterministic. Reloading the client multiple times produces different results.

I believe it's because Logux server processes each of the returned messages asynchronously, and the logical timestamps for the same createdAt are assigned in whatever order the promises happen to execute.

Do you have any idea how I can have same-timestamp messages preserve ordering when reloading? I've tried setting meta.idof the original client for returned messages (since it includes the counter), but that made the original client ignore the messages on reload.

54 replies
Piotr Mikołajek
@pmikolajek

in response to the thread above:
all other clients produce normal debug, something like:

Logux added map/editMap action
index.js:25 Action {type: "map/editMap", payload: {…}}
index.js:25 Meta {id: "1592942048725 clientIdTodo:WBhtspbq:yc8TcHMd 0", time: 1592942048725, reasons: Array(1), added: 2}
index.js:23 From: clientIdTodo:WBhtspbq:yc8TcHMd

the original client sees this:

Logux action 1592942048725 clientIdTodo:WBhtspbq:yc8TcHMd 0 was processed

so just the ID

12 replies
image.png
image.png
Стас Далинин
@kirpich634_gitlab
Добрый день, есть ли способ получать ответ от экшина ?
Я понимаю, что идеологически, мы хотим добиться автономности, но у меня возникла потребность создавать сущность, получать её идентификатор, и продолжать с работать этим идентификатором. ID должен быть уникальным среди всех пользователей.
У меня есть решение: генерировать ID с помощью uuid на клиенте и продолжать работать. Но мне не нравится такой вариант потому что, ID будет участвовать в образовании URL и во первых может сложится ситуация, когда URL будет сгенерирован до того, как фактически сущность будет создана на сервере, второе, id может оказаться не уникальным и в этом случае я думал отправлять с сервера новый id и обновлять сущность но, url в такой момент изменится, а пользователь мог скопировать и использовать старый URL, который оказывается не валидным или ведёт в другое место.
22 replies
Neville Franks
@getclibu_twitter

@ai I'm trying to understand the async/sync nature of server.type( 'SOME_ACTION1', { process()... } calls on the Logux Server.

I've tried async process(){ await dbUpdate() } however 'SOME_ACTION2 -> process() is called before 'SOME_ACTION1' -> process() completes.

I'm only looking for clarification, not reporting an issue or wanting anything changed. If I'm correct and actions fire asynchronously and can't be made synchronous then I need to queue them up so that I can process them in order and to completion.

15 replies
cosminv6u
@cosminv6u

quick question, does Logux Vuex support Vuex Namespaces?

I get: commit.sync is not a function

Eduard Aksamitov
@euaaaio
Can you show me your code?
Namespaced modules should work. We have some tests for this: https://github.com/logux/vuex/blob/master/create-logux/index.test.js#L730
cosminv6u
@cosminv6u
do I need to call new Logux.Store( for root store and for each namespaced module, or for the root only ?
21 replies
cosminv6u
@cosminv6u
another question, can the Logux Proxy interact with the backend server using some JSON hierarchy instead of [arrays of [arrays]] ?
5 replies
cosminv6u
@cosminv6u

quick question.
On a Java Sever using Logux Proxy:

Token is not sent with all Actions, only with Auth command once?
When Proxy calls our stateless Rest Backend with an Action (like subscribe, or custom action) how do we know the authentication took place fine?

ps: I'm using Logux Vuex, do I need to manually add the token to each commit.sync( call?
but what about the subscribe, which is done automatically from the loguxMixin

Andrey Sitnik
@ai
@cosminv6u you do not need to authenticate users for subscriptions and actions. Logux Server already authenticated users in auth phase of the connection and now you can trust to user ID from meta.id
6 replies
Gil Rosenthal
@gilrosenthal
Hi, I was wondering the purpose of the control server? It breaks my express in production, can it be disabled?
5 replies
cosminv6u
@cosminv6u

Hello, basic usecase (Logux Vuex, Logux Proxy, Java Spring Boot Rest Backend):

  • I use Logux to persist a new object (a Car)
  • The DB persist is done async, when it finishes it returns an UUID
  • How do I broadcast to all Subscribers that a new object was persisted? and send the object/uuid

ps: I know that a better approach would have been to set the UUID in Vuex, so the RESEND action would have taken care of all this,
but is there a best practice for my scenario?

  • Do I send a SEND_BACK REST call from the Backend to the Proxy (as it's done when the user first subscribes to a channel)?
25 replies