text:
"Cannot register notification blocks from within write transactions." when making changes in quick succession

How frequently does the bug occur?
Always
Description
I have a List of TextField. When I add items and edit their names quickly, I get a "Cannot register notification blocks from within write transactions" error.
The error doesn't happen if I only update the item name while typing fast. If I press the plus button while typing fast, the error sometimes occurs.
Stacktrace & log output
2023-08-07 21:24:05.203359-0400 TestFocus[28018:1317372] *** Terminating app due to uncaught exception 'RLMException', reason: 'Cannot register notification blocks from within write transactions.'
*** First throw call stack:
(0x1ce0c948c 0x1c7421050 0x10128395c 0x101104638 0x1012ff7fc 0x10131a6b4 0x10131a7f0 0x10140ce2c 0x10140d480 0x1d17d363c 0x1d17b2364 0x1d17be934 0x1d17fb804 0x1d17bb7ac 0x1d1cb0380 0x1efafcef8 0x1efafc5c0 0x1efafb478 0x1d178cf04 0x1d23f2ffc 0x1d17b7ba0 0x1d1794514 0x1d18a7754 0x1d179502c 0x1d6044edc 0x1d6035ca8 0x10131ddf4 0x10131dd10 0x10108a3e0 0x10108a24c 0x1016d96e8 0x1016d9638 0x1016cc900 0x1016cc828 0x1016cd440 0x101719db0 0x101719a1c 0x1016f9d64 0x101822860 0x101823df4 0x101284340 0x10128430c 0x1013d9268 0x1013d90bc 0x101408a2c 0x10141d8c4 0x10141f14c 0x100ffbc98 0x1d1f48aa8 0x1d1f48f90 0x1d1f48eb8 0x1d18328d0 0x1d17a4b50 0x1d18328d0 0x1d204db94 0x1d1788f90 0x1d178583c 0x1d27aa7c4 0x1d1788504 0x1d178abac 0x1d010b748 0x1d0108418 0x1d098a190 0x1d0146cdc 0x1d014b5e8 0x1d014a8e4 0x1d0148b58 0x1d018e524 0x1d046e884 0x1ce189154 0x1ce194dc8 0x1ce12009c 0x1ce1351b8 0x1ce139da0 0x204c4b998 0x1d03cefd8 0x1d03cec50 0x1d18f54f0 0x1d186f7ac 0x1d185c7fc 0x10100a8a4 0x10100a950 0x1eb87f344)
libc++abi: terminating due to uncaught exception of type NSException
(lldb)

Can you reproduce the bug?
Always
Reproduction Steps
Click on the "+" button on the top right repeatedly until the error occurs (on a "iPhone 14 Pro Max - iOS 16.4" emulator)
Optionally, type at the same time (in this case, the plus button doesn't need to be pressed as quickly)
struct ContentView: View {

    @FocusState var focusedId: ObjectId?

    var body: some View {
        NavigationStack {
            ItemsView2(focusedId: $focusedId)
                .navigationTitle("Items")
        }
    }
}

class Item: Object, ObjectKeyIdentifiable {
    @Persisted(primaryKey: true) var _id: ObjectId
    @Persisted var name: String
}

struct ItemsView2: View {
    @ObservedResults(Item.self) var items
    var focusedId: FocusState<ObjectId?>.Binding

    var body: some View {
        List {
            // Items
            ForEach(items) { item in
                ItemView(item: item, focusedId: focusedId)
            }
            .onDelete(perform: $items.remove)
        }
        .toolbar {
            // Add
            Button {
                let item = Item()
                item.name = "Item"
                $items.append(item)
                focusedId.wrappedValue = item._id
            } label: {
                Label("Add", systemImage: "plus")
            }
        }
    }
}

struct ItemView: View {
    @ObservedRealmObject var item: Item

    var focusedId: FocusState<ObjectId?>.Binding

    var body: some View {
        TextField("Item", text: $item.name)
            .focused(focusedId, equals: item._id) // focus
    }
}

Version
13.17.1
What Atlas Services are you using?
Local Database only
Are you using encryption?
No
Platform OS and version(s)
macOS 13.4.1
Build environment
Xcode version: 14.3.1
Dependency manager and version: ...

I'm also seeing this in our app recently.

same here. eek

I tried asyncWrite based on this comment, but it didn't make a difference.
struct ContentView2: View {

    @ObservedResults(Item.self) var items
    @Environment(\.realm) var realm

    @FocusState var focusedId: ObjectId?

    var body: some View {
        NavigationStack {
            List {
                // Items
                ForEach(items) { item in
                    ItemView(item: item, focusedId: $focusedId)
                        .onSubmit {
                            addItem()
                        }
                }
            }
            .navigationTitle("Items")
            .toolbar {
                // Add
                ToolbarItem(placement: .navigationBarTrailing) {
                    Button {
                        addItem()
                    } label: {
                        Label("Add item", systemImage: "plus")
                    }
                }

                // Delete
                ToolbarItem(placement: .navigationBarLeading) {
                    Button(role: .destructive){
                        deleteAll()
                    } label: {
                        Label("Delete all", systemImage: "trash")
                    }
                }
            }
        }
    }

    func addItem(){
        Task {
            try await realm.asyncWrite {
                let item = Item()
                realm.add(item)
                focusedId = item._id
            }
        }
    }

    func deleteAll(){
        $items.remove(atOffsets: IndexSet(integersIn: items.indices))
    }
}

Can we get some eyes on this? It's a blocker bug for us.

I tried asyncWrite based on this comment, but it didn't make a difference.
struct ContentView2: View {

    @ObservedResults(Item.self) var items
    @Environment(\.realm) var realm

    @FocusState var focusedId: ObjectId?

    var body: some View {
        NavigationStack {
            List {
                // Items
                ForEach(items) { item in
                    ItemView(item: item, focusedId: $focusedId)
                        .onSubmit {
                            addItem()
                        }
                }
            }
            .navigationTitle("Items")
            .toolbar {
                // Add
                ToolbarItem(placement: .navigationBarTrailing) {
                    Button {
                        addItem()
                    } label: {
                        Label("Add item", systemImage: "plus")
                    }
                }

                // Delete
                ToolbarItem(placement: .navigationBarLeading) {
                    Button(role: .destructive){
                        deleteAll()
                    } label: {
                        Label("Delete all", systemImage: "trash")
                    }
                }
            }
        }
    }

    func addItem(){
        Task {
            try await realm.asyncWrite {
                let item = Item()
                realm.add(item)
                focusedId = item._id
            }
        }
    }

    func deleteAll(){
        $items.remove(atOffsets: IndexSet(integersIn: items.indices))
    }
}

Affrim. We only use asyncWrite actually, and still see this bug. All of our realms are used with actor isolation.

Hmm - we did merge a PR here -
https://github.com/realm/realm-core/pull/6560
Are you using the latest?

@ianpward I think so. I don't know how to get the exact version of "Realm" (core), but I see "10.42.0 Release notes (2023-07-30)" in the changelog.

@ianpward I think so. I don't know how to get the exact version of "Realm" (core), but I see "10.42.0 Release notes (2023-07-30)" in the changelog.

Have you followed the recommendations here -
https://github.com/realm/realm-swift/issues/4818#issuecomment-1533843587
and here -
https://www.mongodb.com/docs/realm/sdk/swift/react-to-changes/

@ianpward What should I observe?
    func addItem(){
        let token = items.observe { change in
            print(change)
            guard case let .change(items, _) = change else {
                print("something happened")
                return
            }
        }
    }

Type 'RealmCollectionChange<Results<Item>>' has no member 'change'

I am trying to add a new item to a collection, the recommendation seems to apply only to existing items.

@bogdan-pechounov
Some suggestions, first, you cannot observed unmanaged objects, this definitely is gonna throw an error
Only objects which are managed by a Realm support change notifications
let item = Item()
let token = item.observe { change in

Second, you are getting the second error because you are not supposed to add the same item to the realm and item in this case is of type RLMObjectBase which is not what realm.add(:) expects.
I'm a little bit confused about your sample.
Are you trying something more like this
func addItem(){
        let realm = try! Realm()
        let newItem = TestObject()
        // Adds the item
        try! realm.write {
            realm.add(newItem)
        }

       // Observe changes on item, this will trigger when we change the name
        let token = newItem.observe { change in
            print(change)
            guard case let .change(item, _) = change else {
                print("something happened")
                return
            }
            // Async write within the notification block which will committed asynchronously after the block completes,
            realm.writeAsync {
               // Do any operation within the notification block
            }
        }
        try! realm.write {
            newItem.name = "test"
        }
    }

@dianaafanador3 I was trying to replicate this code, but for adding a new item:
let token = dog.observe(keyPaths: [\Dog.age]) { change in
    guard case let .change(dog, _) = change else { return }
    dog.realm!.writeAsync {
        dog.isPuppy = dog.age < 2
    }
}

If I only change the item name, then there are no errors.
    @ObservedRealmObject var item: Item

    var body: some View {
        TextField("Item", text: $item.name)
    }

The error occurs when adding a new item. (e.g. pressing the plus button repeatedly, typing and then pressing the plus button)
        .toolbar {
            // Add
            Button {
                let item = Item()
                item.name = "Item"
                $items.append(item)
                focusedId.wrappedValue = item._id
            } label: {
                Label("Add", systemImage: "plus")
            }
        }

Hmm - we did merge a PR here - realm/realm-core#6560
Are you using the latest?

I am using 10.42.0 of RealmSwift, but it doesn't appear to pull in a newer core artifact than 13.7.1? I'll try updating the RealmDatabase package by itself

@ianpward the realm-swift repo's Package.swift explicitly calls for a version:
let coreVersion = Version("13.17.1")

@bogdan-pechounov I was able to reproduce your issue. The error mentioned on this issue can be a little bit misgiving, this is not happening because you are registering a notification in a write transaction, is because your write is happening while the realm is in a transaction, which we verify later during the write commit and throw an exception. @jeffypooo do you have the same use case as the one described above, do you get this error while on SwiftUI View while using ObservedResults and ObservedRealmObject

@dianaafanador3 To clarify, does the binding $item.name for ObservedRealmObject create a write transaction for each character typed?
Is the reason such a check exist is in case we create a new item that depends on the entire collection, e.g items.max? (if 2 transactions happen at the same time, the 2 items would have the same value for the order field)
                let order = (items.max(of: \Item.order) ?? 0) + 1
                let item = Item(name: name, order: order, userId: app.currentUser?.id)
                $items.append(item)

(the check is only for ObservedResults  and not ObservedRealmObject?)
Is there a way to queue transactions?

There's currently no debouncing. We looked into adding it and concluded that it was going to be sufficiently complicated that we might as well put the effort into making small writes work better instead.
Write transactions can't happen "at the same time" as they involve a global (per-Realm) lock. However, in that code you're checking for the max outside of a write transaction, and so may be reading a stale value and end up with a duplicate. Wrapping the whole thing in an explicit write transaction is required for correct results:
realm.write {
    let order = (items.max(of: \Item.order) ?? 0) + 1
    let item = Item(name: name, order: order, userId: app.currentUser?.id)
    $items.append(item)
}

Async writes are the mechanism to queue writes. If you call asyncWrite from within a write transaction the block will be invoked after the current write transaction completes.

@tgoyne Are actors necessary, or can I just use Task? Since the realm comes from the environment, I am not sure how I would define a custom actor.
struct ContentView2: View {

    @ObservedResults(Item.self) var items
    @Environment(\.realm) var realm

    @FocusState var focusedId: ObjectId?

    var body: some View {
        NavigationStack {
            List {
                // Items
                ForEach(items) { item in
                    ItemView(item: item, focusedId: $focusedId)
                        .onSubmit {
                            addItem()
                        }
                }
            }
            .navigationTitle("Items")
            .toolbar {
                // Add
                ToolbarItem(placement: .navigationBarTrailing) {
                    Button {
                        addItem()
                    } label: {
                        Label("Add item", systemImage: "plus")
                    }
                }

                // Delete
                ToolbarItem(placement: .navigationBarLeading) {
                    Button(role: .destructive){
                        deleteAll()
                    } label: {
                        Label("Delete all", systemImage: "trash")
                    }
                }
            }
        }
    }

    func addItem(){
        Task {
            try await realm.asyncWrite {
                print("COUNT", items.count)
                let item = Item()
                realm.add(item)
                focusedId = item._id
            }
            print("COUNT AFTER", items.count)
        }
    }

    func deleteAll(){
        $items.remove(atOffsets: IndexSet(integersIn: items.indices))
    }
}

Also, I noticed that the error doesn't occur if I remove the line focusedId = item._id. (or if the new item is too far down the list to be visible and gain focus)
    func addItem(){
        print(Thread.current)
        Task {
            try await realm.asyncWrite {
                print("COUNT", items.count, Thread.current)
                let item = Item()
                realm.add(item)
                //focusedId = item._id
            }
            print("COUNT AFTER", items.count, Thread.current)
        }
    }

<_NSMainThread: 0x2819280c0>{number = 1, name = main}
COUNT 49 <_NSMainThread: 0x2819280c0>{number = 1, name = main}
COUNT AFTER 50 <_NSMainThread: 0x2819280c0>{number = 1, name = main}

Since the closure is executed on the main thread, maybe animating the keyboard up interferes with realm in some say?
COUNT 0
COUNT AFTER 1
COUNT 1
COUNT AFTER 2
COUNT 2
COUNT AFTER 3
COUNT 3
COUNT AFTER 4
COUNT 4
COUNT AFTER 5
COUNT 5
COUNT AFTER 6
COUNT 6
COUNT AFTER 7
COUNT 7
COUNT AFTER 8
COUNT 8
COUNT AFTER 9
COUNT 9
COUNT 10
COUNT AFTER 11
COUNT 11
COUNT AFTER 12
COUNT AFTER 12
COUNT 12
COUNT 13
COUNT AFTER 14
COUNT AFTER 14
COUNT 14
COUNT AFTER 15
COUNT 15
COUNT AFTER 16
COUNT 16
COUNT AFTER 17
COUNT 17
COUNT AFTER 18
COUNT 18
COUNT AFTER 19
COUNT 19
COUNT AFTER 20
COUNT 20
COUNT AFTER 21
COUNT 21
2023-08-21 18:14:46.406612-0400 TestFocus[96011:3507884] *** Terminating app due to uncaught exception 'RLMException', reason: 'Cannot register notification blocks from within write transactions.'
*** First throw call stack:
(0x1b6d3148c 0x1b0081050 0x10122e8e4 0x1010af5c0 0x1012aa784 0x1012c563c 0x1012c5778 0x1013b7db4 0x1013b8408 0x1ba438db8 0x1ba417ae0 0x1ba4240b0 0x1ba460f80 0x1ba420f28 0x1ba915b00 0x1d87c6ef8 0x1d87c65c0 0x1d87c5478 0x1ba3f2680 0x1bb4b3cb4 0x1bac83eec 0x1ba3f0258 0x1ba3eac5c 0x1ba3e5ab8 0x1bb4b3c80 0x1bb4b3bb8 0x1ba49804c 0x1ba3e38a0 0x1ba3e3804 0x1ba3e398c 0x1b6db1968 0x1b6d4159c 0x1b6d9d294 0x1b6da1da0 0x1ed920998 0x1b903380c 0x1b9033484 0x1ba55ac68 0x1ba4d4f1c 0x1ba4c1f6c 0x100fb582c 0x100fb58d8 0x1d4540344)
libc++abi: terminating due to uncaught exception of type NSException
(lldb)

If I simply use $items.append(Item()), there are no issues, so queuing transactions might not be necessary. The problem is when an ItemView gains focus.
        let item = Item()
        $items.append(item)
        focusedId = item._id

We usually encounter this when trying to start change observation as a result of a write, but it does seem to be limited to situations where the presentation mode is changing. The most common occurrence for us is when a button is clicked that:

dismisses a sheet
writes some data to realm

Interesting that both reproduction cases mentioned involve buttons as well

I've also recently encountered this exception in the AppIntent.perform() implementation of my app (an iOS Shortcuts action). It consistently crashes at Realm.beginWrite(). However, if I call realm.refresh() just before initiating the write transaction, the crash doesn't occur. Everything is on main queue.
Thread 1: "Cannot register notification blocks from within write transactions."

#0	0x000000018fa425e0 in __exceptionPreprocess ()
#1	0x0000000187dbfc00 in objc_exception_throw ()
#2	0x000000010801ce40 in -[RLMRealm verifyNotificationsAreSupported:] ()
#3	0x0000000107f23b98 in RLMNotificationToken* RLMAddNotificationBlock<RLMResults>(RLMResults*, void (objc_object*, RLMCollectionChange*, NSError*) block_pointer, NSArray<NSString*>*, NSObject<OS_dispatch_queue>*)
#4	0x0000000108027270 in -[RLMResults addNotificationBlock:keyPaths:queue:] at .../Realm/RLMResults.mm:562
#5	0x0000000106b4b440 in RealmCollectionImpl.observe(keyPaths:on:_:) at .../RealmSwift/Impl/RealmCollectionImpl.swift:108
#6	0x0000000106af1998 in RealmPublishers.CollectionChangeset.receive<τ_0_0>(subscriber:) at .../RealmSwift/Combine.swift:1537
#7	0x0000000198d1a6ec in Publishers.Map.receive<τ_0_0>(subscriber:) ()
(some Combine stuff...)
#26	0x0000000198d31434 in Publishers.Map.Inner.receive(_:) ()
#27	0x0000000106af6ffc in partial apply for closure #1 in RealmPublishers.CollectionChangeset.receive<τ_0_0>(subscriber:) ()
#28	0x0000000106b4d0c4 in closure #1 in RealmCollectionImpl.wrapObserveBlock(_:) at .../RealmSwift/Impl/RealmCollectionImpl.swift:131
#29	0x0000000106b4da08 in partial apply for closure #1 in RealmCollectionImpl.wrapObserveBlock(_:) ()
#30	0x0000000106b46aa4 in thunk for @escaping @callee_guaranteed (@guaranteed RLMResults<Swift.AnyObject>?, @guaranteed RLMCollectionChange?, @guaranteed Error?) -> () ()
#31	0x0000000107f25478 in realm::CollectionChangeCallback::Impl<(anonymous namespace)::CollectionCallbackWrapper>::after(realm::CollectionChangeSet const&)
#32	0x00000001082c9590 in realm::_impl::CollectionNotifier::after_advance() ()
#33	0x00000001082ca26c in realm::_impl::NotifierPackage::after_advance() ()
#34	0x00000001082e5c34 in realm::_impl::transaction::begin(std::__1::shared_ptr<realm::Transaction> const&, realm::BindingContext*, realm::_impl::NotifierPackage&) ()
#35	0x00000001082db1ec in realm::_impl::RealmCoordinator::promote_to_write(realm::Realm&) ()
#36	0x0000000108356db8 in realm::Realm::do_begin_transaction() ()
#37	0x0000000108357dd8 in realm::Realm::begin_transaction() ()
#38	0x000000010801d2bc in -[RLMRealm beginWriteTransactionWithError:] at .../Realm/RLMRealm.mm:724
#39	0x0000000106b3f708 in Realm.beginWrite() [inlined] at ...RealmSwift/Realm.swift:288
#40	0x0000000106b3f6f4 in Realm.write<τ_0_0>(withoutNotifying:_:) at .../RealmSwift/Realm.swift:255

I'm not entirely sure whether this is an issue with my usage, or if it's related to the original issue. But I haven't been able to identify the cause myself. I've also tried versions before and after https://github.com/realm/realm-core/pull/6560, and they reproduce the same crash.

We are also encountering this issue. When asnyWrite (or normal writes) are triggered in rapid succession (in our case caused by server requests) and there is a notification block observing this collection (no writes in the notification block). Will upload more details later today.

I'm running into this on latest realm-swift, iPadOS 16.5 with debugger attached.

Thanks for sharing. That would require a full rewrite of my RealmSwift usage, to remove all SwiftUI usage and so on... Difficult choice for a large project. I hope there is another solution to this constant crashing.

I tried asyncWrite based on this comment, but it didn't make a difference.

@bogdan-pechounov that commenter suggests using writeAsync not asyncWrite but not sure that would make a difference

update: I've converted all Realm writes to asyncWrite on a new globalActor and inside Task.detached but still facing constant crashing. Now removing all usage of ObservedResults, ObservedRealmObject, StateRealmObject which I suspect are problematic.
This makes me want to abandon Realm ASAP - without being able to use any of the SwiftUI conveniences and inaction for years on this issue, the upside is getting hard to appreciate

@aehlke In our case I believe the core problem was exactly the parallelisation that lead to the unexpected behaviour, which is fair, considering that opening many realms in async context without specifying any actors.
Imagine this: parallel code is a) writing an object "dog" to a realm collection and b) registering a change listener to this realm collection. Whether a notification for this dog fires is then no longer deterministic, since it depends on which parallel code runs first. (I imagine this could be happening with something like ObservedResults as well)
Now that being said, I also think this could be handled way better, e.g. by having the registration for the change listener be async as well, waiting for any write locks to finish before registering. Or waiting to finish any change listener registration before allowing to open any write transaction.
What frustrates me the most, is that realm does not allow for us to catch errors, but rather crashes the app, since they say it's "considered to be programmer error". In many cases this makes sense, but with these very fine grained, sometimes hard-to-reproduce problems in concurrency, going into production is just a huge pain.

It turns out that while 10.39.1 was supposed to make it so that notification blocks could be registered from within write transactions until changes were actually made, this didn't actually work. https://github.com/realm/realm-swift/pull/8439 makes it so that it does.

@davidkessler-ch appreciate the thoughts
@tgoyne great news, thanks for the update
For my code, I found a spot I'd missed with observation happening off the custom globalActor and fixed that; seems stable now that ALL writes AND observations happen on a custom globalActor and in Task.detached, without needing to finish ridding my code of ObservedRealmObject etc

@tgoyne I updated the package (RealmDatabase 13.25.0, iOS 17.2) and there are no longer any issues. Thank you!

authors: aehlke bogdan-pechounov davidkessler-ch dianaafanador3 gongzhang ianpward jeffypooo tgoyne

repo: realm/realm-swift


text:
Cannot start or build reason app inside node:9-alpine container

yarn start and yarn build both fail inside a docker container built using the instructions in the docs. Running inside alpine is a must for compiling inside a CI pipeline.
To reproduce:

Build image using this Dockerfile. e.g.: docker build . -t sad-reson

FROM node:9-alpine

RUN apk update && apk upgrade && \
  apk add build-base bzip2 git tar curl ca-certificates python

RUN addgroup -S app && adduser -S -G app app

USER app

RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
ENV PATH=~/.npm-global/bin:$PATH
# RUN npm install -g reason-cli@3.2.0-linux # fails the same, with or withouth this line
RUN npm install -g bs-platform

RUN cd ~ \
  && yarn create react-app my-app --scripts-version reason-scripts \
  && cd my-app

WORKDIR /home/app/my-app

yarn start fails. try by: docker run --rm -it sad-reason yarn start
yarn build fails. try by: docker run --rm -it sad-reason yarn build

Sample error:
docker run --rm -it sad-reason yarn start
Failed to compile.

./src/index.re
Module build failed: Error:
/bin/sh: script: not found
    at Array.map (<anonymous>)
    at <anonymous>
error An unexpected error occurred: "Command failed.
Exit signal: SIGINT
Command: sh
Arguments: -c react-scripts start
Directory: /home/app/my-app
Output:
".
info If you think this is a bug, please open a bug report with the information provided in "/home/app/my-app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Does this work with the stock create-react-app (in JS)?

Hi @portenez, thanks for filing this issue!
Could you please paste the full output of the error logs? I don't know if any of the maintainers here use Docker, and installing it to debug this issue would be a serious time commitment from us. Additionally, pasting the error logs could give us a lot for information and we can tell if it's a known issue from Reason, or from the upstream create-react-app.
I also recommend searching the create-react-app repo for more information on using it with Docker.
Thanks again!

Create react app does work. I have another project with a similar setup (create react app) , but no reasonml. that one work just fine. I'll double check versions and post a dockerfile for that one (just create react app) as soon as I have a chance. How do I enable the debug logs? I'll post them here.

You said the “start” command fails? What do yoya mean by fails? This is a difficult and time consuming set up to replicate, so we would appreciate knowing how it fails, there may be a different error than just running it in docket.

Create React App versions
working = YES
Version 1 with npx
FROM node:9-alpine

RUN addgroup -S app && adduser -S -G app app

USER app

RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
ENV PATH=~/.npm-global/bin:$PATH

RUN cd ~ \
  && npx create-react-app my-app

WORKDIR /home/app/my-app

Version 2 with yarn
FROM node:9-alpine

RUN addgroup -S app && adduser -S -G app app

USER app

RUN mkdir ~/.npm-global
RUN npm config set prefix '~/.npm-global'
ENV PATH=~/.npm-global/bin:$PATH

RUN cd ~ \
  && yarn create react-app my-app

WORKDIR /home/app/my-app

To run

Create a Dockerfile with the code above
Build image using the Dockerfile. e.g.: docker build . -t happy-js
yarn start succeeds. try by: docker run --rm -it happy-js yarn start
yarn build fails. try by: docker run --rm -it happy-js yarn build

@rrdelaney I updated the original ticket with the output that I'm getting.
More than docker, looks like a Linux issue. To replicate any of the scenarios pretty much these are the steps:

Get/install docker: https://www.docker.com/docker-mac
In a dir touch Dockerfile, and add the contents of any of my examples. At this point you have docker + the Dockefile with the instructions on how to create the container.
Build the container by calling docker build in the same dir as the Dockerfile docker build . -t ${tagUseAsRefToRun}.
Run the built container by using docker run: docker run --rm -it ${tagUseAsRefToRun} ${comandsToExecute}.

So for example
mkdir dockerTest
cd dockerTest
touch Dockerfile
vim Dockerfile #here paste the contents
docker build . -t test-container
docker run --rm -it test-container yarn start # the last tokens in the cli are passed to the container
#or
docker run --rm -it test-container yarn build

An alternative way to reproduce it is to just open a terminal in node:9-alpine and type all the commands in there. More difficult IMO.
You could start such terminal by:
docker run --rm -it node:9-alpine /bin/ash

Which will give you a completely clean node:9-alpine container

It looks like Alpine Linux doesn’t have the script command. reason-scripts running on Linux system requires that command to be present.
Please see https://github.com/reasonml-community/bs-loader/issues/35 and https://github.com/gliderlabs/docker-alpine/issues/160 for more information.

I see, that's a shame. I guess I'm going to try using debían instead. Thanks for the help.

As reference, did xenial base container worked just fine:
FROM ubuntu:xenial

RUN apt-get update \
  && apt-get install -y curl \
    build-essential \
    git \
  && apt-get clean \
  && apt-get autoremove --purge

RUN curl -sL https://deb.nodesource.com/setup_9.x | bash - \
  && apt-get install -y nodejs \
  && apt-get clean

RUN npm install -g yarn
RUN yarn add global reason-cli@3.2.0-linux
RUN yarn add global bs-platform

RUN mkdir -p /opt \
  && yarn create react-app my-app --scripts-version reason-scripts \
  && cd my-app

WORKDIR /opt/my-app

CMD ["yarn", "start"]

build contianerdocker build . -t reason-builder
serve docker run --rm -it reason-builder
build assets docker run --rm -it reson-builder yarn build

@portenez I just ran into this myself and apk add util-linux adds script for me. Perhaps that's an alternative for you if you wanna get a slimmer container.

source: gharchive/issue

authors: anmonteiro portenez rrdelaney

repo: reasonml-community/reason-scripts

license: MIT

license_type: permissive

license_source: github-api


text:
Request to add committers

Provided they're willing, I'd like to propose the following candidates for rebar/rebar write permissions based on their contribution history.

Luis Rascão (@lrascao)
Tomas Abrahamsson (@tomas-abrahamsson)
David Kubecka (@kejv)

+1

Yeah, as much as I'd like to be able to put more time in rebar 2.x, I already struggle to find enough time to do work on rebar3.
As long as the overall objective doesn't change (rebar3 is expected to do the lion's share of new feature development, rebar 2.x cannot break compatibility because rebar3 is technically rebar 3.0.0, and so on) I would be happy to get more hands maintaining rebar 2.x.

+1, willing and able

Pulling in some owners of the rebar org: @Vagabond @jaredmorrow

+1
On Friday, October 2, 2015, Tristan Sloughter notifications@github.com
wrote:

Pulling in some owners of the rebar org: @Vagabond
https://github.com/Vagabond @jaredmorrow
https://github.com/jaredmorrow
—
Reply to this email directly or view it on GitHub
https://github.com/rebar/rebar/issues/547#issuecomment-145012799.

@jaredmorrow or @Vagabond can you do the addition? I can't create a new team.

Sorry, just got back from a long meetup last night.  I added an additional team with them being invited.

Hi all,
sorry for late reply, I have just came back from vacation.
I am certainly willing to help (and hopefully also able timewise).
Regards,
David
---------- Původní zpráva ----------
Od: Tuncer Ayaz notifications@github.com
Komu: rebar/rebar rebar@noreply.github.com
Datum: 1. 10. 2015 21:24:55
Předmět: [rebar] Request to add committers (#547)
"
Provided they're willing, I'd like to propose the following candidates for
rebar/rebar write permissions based on their contribution history.

Luis Rascão (@lrascao(https://github.com/lrascao))
Tomas Abrahamsson (@tomas-abrahamsson
(https://github.com/tomas-abrahamsson))
David Kubecka (@kejv(https://github.com/kejv))

—
Reply to this email directly or view it on GitHub
(https://github.com/rebar/rebar/issues/547).
"=

@jaredmorrow, ping re: @kejv?

@kejv, if I understand @jaredmorrow correctly, you should be already invited.

Yes, he's indeed been invited.

@jaredmorrow  Hmm, pardon me but I can't see the invitation you are talking about, neither in my github account nor in my mail box. Can you please double check that I was reaaly invited, or direct to the place where I can accept the invitation?

@kejv I just doubled checked and updated the invite.  I don't know how to get rid of the invite and do it again, but it sure seems like it is pending.

I think it's safe to close this as resolved by now.

authors: ferd jaredmorrow kejv lrascao tsloughter tuncer

repo: rebar/rebar

license_source: bigquery


text:
add more sorting options for everything

the scouting leader duc view and also a scouter's past matches should have more sorting options besides sorting by saved time

sort by all of the different fields


text:
sound: fix the percentage

Signed-off-by: Nicolas Adenis-Lamarre nicolas.adenis-lamarre@gmail.com

:+1:

source: gharchive/pull-request

authors: digitalLumberjack nadenislamarre

repo: recalbox/recalbox-emulationstation

license: mit


text:
InputGeom::intersectSegmentTriangle only works from one direction

Hello there!
I was cracking my head here trying to understand why one of my InputGeom::raycastMesh queries was returning false even though the segment and the triangle were clearly intersecting. It seems to be because the InputGeom::intersectSegmentTriangle implementation seems to be following the "Intersecting Ray or Segment Against Triangle" chapter section from the "Real-Time Collision Detection" book by Christer Ericson, the issue seems to stem from that a segment has no direction, a ray does, and even though our function is named intersectSegmentTriangle it seems is to only work on a specific triangle winding and ray direction. Test data:
sp = 27938.0000, -5453.00000, -25048.0000
sq = 27922.0000, -4574.00000, -25148.0000
a = 27828.353516, -4585.178223, -25283.853516,
b = 27927.289062, -4585.178223, -24941.593750
c = 27927.289062, -4585.178223, -25283.857422

This will return false (no intersection), but if you switch sq with sp, now it returns an intersection. I'm not too sure how to tackle this one honestly, maybe a different algorithm? Test both directions of the ray? I'm happy to PR a solution if we can agree on one. It's important to note raycastMesh is not used for navmesh generation, it's only being used for debugging in the repo.

Hi!  Super appreciate you finding this and even where the original code was likely adapted from!  Certainly makes my life easier :)
I suspect that much of this code (and the code in RecastDemo more generally) has some latent issues like this.  This demo project was created mostly to showcase features of Recast and Detour so it's likely somewhat buggy and probably relies on a number of opengl-specific things like triangle winding order.  It wasn't really meant to be part of Recast itself when it was written.
That being said, I still think it's important that this code is robust and doesn't mislead people with weird issues like this since it is part of the repo, so it's definitely worth fixing.  Will add this to my todo list, but If you're so inclined a PR would be greatly appreciated. 😉 Thanks again.

Please! 🙏  It's been my personal mission to try to improve all 1 and 2 letter variables with more descriptive names, but since I'm trying really hard not to break things in the process it's been slow going.  I've also been focused on the core library rather than the demo project so far.
The other issue is probably worth a separate PR just to keep things organized if you're inclined to tackle that as well.  Again, thanks for bringing up these bugs and for being open to writing PRs to fix them!

Sounds good @grahamboree! I'll try cooking some PRs tonight, worst case, this weekend. Another one I'm considering is this one:
https://groups.google.com/g/recastnavigation/c/m_JMXgmlIs4
Would you have any clues? Why we don't use y? My only guess is that point in convex hull algorithms aren't easy to implement and this is close enough?

authors: astutejoe grahamboree

repo: recastnavigation/recastnavigation

license: Zlib


text:
Library uses float which causes rounding errors

Describe the bug
The Go library uses float for monetary values. Float is widely discouraged as it does not contain the necessary precision to handle currency values.
To Reproduce
Fetch a credit invoice of $-79.99. Multiply by 100.0 and convert to an `int:
// invoice.Subtotal = -79.99
x = int(invoice.Subtotal * 100.0)
assert.equal(-7999, x)

Error: Not equal:
       expected: -7999
       actual  : -7998

Expected behavior
Library should use a Decimal or other fixed-point
Your Environment

Which version of this library are you using? v3.8.0 f4d23f429fa01778f037d3b88c04c380f8fd745d
Which version of golang are you using? 1.14.9

Thank you for reporting this @Talljoe. We are aware of this limitation and are investigating solutions that we can employ in our upcoming 4.x client release. Updating the 3.x client would introduce a breaking change to existing implementations, unfortunately. We will leave this issue open and will provide updates when they become available.

This was 4 years ago and it's still not fixed in the product? I just submitted a support ticket. This issue results in incorrect billing calculations.

authors: Talljoe douglasmiller wellsync-matt-may

repo: recurly/recurly-client-go


text:
Provide high resolution image

I've an image compression code along with orientation.
Can you please provide high-resolution images too :)

Hi @HashirHussain - I've increased the default resolution of the images. I've also added a script so you can generate your own images of any resolution - see the README for details.

authors: HashirHussain recurser

repo: recurser/exif-orientation-examples


text:
Fix faulty kserve tests

KServe (aka LLM or WatsonX) has some failing tests. This PR wants to fix them.
As part of the test fixing, I had to do some refactoring and remove yq from poetry.
yq dependency installation should be handled in a different PR to solve https://github.com/red-hat-data-services/ods-ci/issues/953

PR validation

rhods-ci-pr-test/2100 a better run, 2 failures remaining ODS-2377 & ODS-2380

@bdattoma please, there seem to be 2 trailing lines reported by robocop and consider adding the doc to the one keyword robocop complan. :slightly_smiling_face:

@bdattoma please, there seem to be multiple trailing whitespace lines reported by robocop and consider adding the doc to the one keyword robocop complan. 🙂

done

authors: bdattoma jstourac

repo: red-hat-data-services/ods-ci


text:
proto: remove depricated label

As we have decided not to depreciate desiredClientOperatorChannel  hence removing it

/lgtm

authors: nb-ohad rchikatw

repo: red-hat-storage/ocs-operator


text:
Handle nil records.key cases in fuzzy records

This Pull Request introduces a change to the code to prevent duplicate events when the record key is null.
Previously, the records were being iterated using the @records.each do |record| loop. However, there was no check for the existence of the record key before proceeding with the processing.
With this change, the line next unless record.key has been added to skip to the next record when the key is null.

Changed PR title

gemspec conflict will be resolved later @jsotofernandez , awaiting for the fixes on the other functions also

authors: jsotofernandez malvadsredborder

repo: redBorder/logstash-filter-fuzzy


text:
Appstudio update test-component-pac-nozl

Pipelines as Code configuration proposal
To start the PipelineRun, add a new comment with content /ok-to-test
For more detailed information about running a PipelineRun, please refer to Pipelines as Code documentation Running the PipelineRun
To customize the proposed PipelineRuns after merge, please refer to Build Pipeline customization

Pipelines as Code CI has failed.There was an error creating the PipelineRun: test-component-pac-nozl-on-pull-request-
creating pipelinerun test-component-pac-nozl-on-pull-request- in namespace build-e2e-vllh-tenant has failed.
Tekton Controller has reported this error: the namespace of the provided object does not match the namespace sent on the request

Pipelines as Code CI/test-component-pac-nozl-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
5 seconds
init

✅ Succeeded
26 seconds
clone-repository

✅ Succeeded
39 seconds
sast-snyk-check

✅ Succeeded
1 minute
build-container

✅ Succeeded
7 seconds
sbom-json-check

✅ Succeeded
24 seconds
inspect-image

✅ Succeeded
7 seconds
deprecated-base-image-check

✅ Succeeded
4 minutes
clair-scan

✅ Succeeded
42 seconds
clamav-scan

✅ Succeeded
16 seconds
show-sbom

✅ Succeeded
18 seconds
show-summary

Pipelines as Code CI/test-component-pac-nozl-on-pull-request has successfully validated your commit.

StatusDurationName

✅ Succeeded
8 seconds
init

✅ Succeeded
19 seconds
clone-repository

✅ Succeeded
40 seconds
build-container

✅ Succeeded
21 seconds
sast-snyk-check

✅ Succeeded
7 seconds
sbom-json-check

✅ Succeeded
26 seconds
inspect-image

✅ Succeeded
6 seconds
deprecated-base-image-check

✅ Succeeded
7 seconds
clair-scan

✅ Succeeded
36 seconds
clamav-scan

✅ Succeeded
6 seconds
show-summary

✅ Succeeded
6 seconds
show-sbom


text:
do not merge testing clusters

Description
Please include a summary of the changes and the related issue. Please also include relevant motivation and context. List any dependencies that are required for this change.
Issue ticket number and link
Type of change

[ ] Bug fix (non-breaking change which fixes an issue)
[ ] New feature (non-breaking change which adds functionality)
[ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
[ ] This change requires a documentation update

How Has This Been Tested?
Please describe the tests that you ran to verify your changes. Provide instructions so we can reproduce. Please also list any relevant details for your test configuration
Checklist:

[ ] I have performed a self-review of my code
[ ] I have commented my code, particularly in hard-to-understand areas
[ ] I have made corresponding changes to the documentation
[ ] I have added meaningful description with JIRA/GitHub issue key(if applicable), for example HASSuiteDescribe("STONE-123456789 devfile source")
[ ] I have updated labels (if needed)

/test ?


text:
fix: decreasing the sample data observation time

this commit decreases the sample data observation time as some cluster does not send data over the full 24h window.

changed back to draft as I found a better solution for the query

changed back to draft as I found a better solution for the query

leaving the 1h change for now as the promtool fails with the new query and the alert needs to be fixed for now.

/retest


text:
feat(topic create): add flag for retention size

Description
topic create should have a flag for setting the retention size.
fixes #523
Verification Steps

Create topics using both normal and interactive mode.
Normal mode should support a --retention-bytes flag.
Interactive mode should prompt for retention size.

Type of change

[X] New feature (non-breaking change which adds functionality)

Checklist

[X] Documentation added for the feature
[ ] CI and all relevant tests are passing
[ ] Code Review completed
[ ] Verified independently by reviewer

❯ rhoas kafka topic list
  NAME (6)         PARTITIONS   RETENTION TIME (MS)   RETENTION SIZE (BYTES)
 ---------------- ------------ --------------------- ------------------------
  topic-4                 100   604800000             -2
  topic-5                   1   604800000             -2

I should not be able to enter -2 as a value.
This flag will also be needed in the update command.

was thinking to add this to update command in a separate PR.

repo: redhat-developer/app-services-cli


text:
Version bump to 3.6.0

Signed-off-by: Parthvi Vala pvala@redhat.com

What type of PR is this:

What does this PR do / why we need it:
Which issue(s) this PR fixes:

Fixes  part of #6412
PR acceptance criteria:

[ ] Unit test

[ ] Integration test

[ ] Documentation

How to test changes / Special notes to the reviewer:

/override windows-integration-test/Windows-test
/override OpenShift-Integration-tests/OpenShift-Integration-tests

repo: redhat-developer/odo


text:
Add the fake login page

Added interactive login screen
moved the login logic to LoginScreen.cs

would fix #63

authors: bartoval thoraxe

repo: redhat-gamedev/srt-godot-client


text:
analytics-operator 0.1.0 CSV changes

Updated CSV file description and sample config.

/pipeline restart community-hosted-pipeline


text:
Allow private registries

The CI pipeline is not capable to push to a private registry using
provided credentials.
The original buildah task doesn't support a custom registry credentials
stored as "dockerconfigjson" so this commit adds a custom temporary
buildah task that use a secret workspace with token.
JIRA: ISV-855
This PR also replace git-clone ClusterTask with a Task.

@MarcinGinszt I addressed your comments. Can you check it again? Thanks


text:
Users tl;dr dialog about unfinished action

Need to make the dialog that apears when you run a new action while you didn't finish the previous action shorter and clearer, as users are tl;dr and mistake it with confirmation to start new action.
Information about state file and possibility to resume with -c should be included.

Revamped the dialog and made it noninteractive to avoid mistakes in 191b53e2d3ac85c84a0.

repo: redhat-openstack/rdopkg


text:
Add CI Pod deployment

Improvements:

CI Pod deployment of following containers:

Elasticsearch
Kiabana
Grafana
JupyterLab
Nginx
Flask

@RobertKrawitz, thx for your reviewing.
I have updated all your comments

repo: redhat-performance/benchmark-runner


text:
Add support for virtual uc on first node

fixes
#173
#174

@masco have added the option to specify the virtual undercloud. Could you please review

@masco Could you please have look. If this needs any further changes as I'm testing it

repo: redhat-performance/jetpack


text:
Use ansible built-in variable to set the home directory

This is needed when the user is root.

@jtaleric @aakarshg PTAL.

repo: redhat-performance/stockpile


text:
Add support for redisgraph / GORM

Something like:  https://gorm.grails.org/6.1.x/neo4j/manual/index.html

@owentechnologist I will have the basic graph annotations in near the end of the year. Then I'm merging this https://github.com/bsbodden/jredisgraph-qb with it after refining it

authors: bsbodden owentechnologist

repo: redis/redis-om-spring


text:
bug

org.redisson.connection.SentinelConnectionManager
row  175   break;  is bug
it let this code always error.
throw new RedisConnectionException("SENTINEL SENTINELS command returns less than 2 nodes! At least two sentinels should be defined in Redis configuration. Set checkSentinelsList = false to avoid this check.", lastException);

Set checkSentinelsList = false to avoid this check

Set checkSentinelsList = false to avoid this check
but I want to use redis sentinel config  auto set redission sentinel config
and not this property in redis sentinel config .

sentinel

this is my RedisProperties ，i want if take effect on redisson

Set checkSentinelsList = false to avoid this check

https://github.com/redisson/redisson/issues/4174#issuecomment-1060194722
this is my redis config, i want it take effect on redisson and no other config.

Set checkSentinelsList = false to avoid this check

spring.redis.sentinel.master=mymaster
spring.redis.sentinel.nodes=ip:port
spring.redis.sentinel.password=pass
this is my redis config, i want it take effect on redisson and no other config.

repo: redisson/redisson


text:
Method to force fetch value in RLocalCachedMap from Redis?

I have been experimenting with RLocalCachedMap to sync a critical cache map across multiple pods.
As I increase the scale of my tests, I have started noticing some misses in cache invalidation events from one pod to another. And that is fine, I know to a small extent that is possible and expected. This is the config I'm using:
LocalCachedMapOptions.defaults().storeCacheMiss(true).reconnectionStrategy(ReconnectionStrategy.CLEAR);
getRedissonClient().getLocalCachedMap("UserCache", cachedMapOptions);

But there are few critical sections in my code where I can't afford an inconsistent state and am willing to fetch the latest value directly from Redis even with the cost of efficiency.
Is there any way I can do this through RLocalCachedMap where I forcefully fetch a key from Redis and not from whatever is locally cached?
Something along the lines of ((RLocalCachedMap<String, User>) userCache).getFromRedis(userId) ?
One hacky implementation I was thinking of was keeping an RMap<> with the same name as my RLocalCachedMap and fetching through it when I need the Redis state, will that work? Will Redisson support that?
Or perhaps a method which invalidates local cache for a particular key in RLocalCachedMap? I can do that before fetching to achieve this, but couldn't find such a method in the docs

@sggts04 set the cacheSize to -1, it will disable the localcache and always fetch the data from redis, but doing this will affect the entire localcachemap not particular key.
JavaDoc

That I am aware of, if I wanted to affect all keys I could have just done .clearLocalCache()

One option is to use the RMap along with RLocaCacheMap, but there will be inconsistencies if the RMap is updated and RLocalCacheMap's CachedMap is not cleared.
Other one is, get the cachedMap and remove that particular key from the cache, then get that key again.

get the cachedMap and remove that particular key from the cache

This is what I'm curious about, I couldn't find a direct method to do this.
Does this work: cachedMap.cachedKeySet().remove(userId); ? Or is there some other way to achieve this
@raja2102598

i checked it, this doesn't work, because cachedKeySet() gives new reference.
Go with Rmap or use multiple RLocalCachedMap instances (LocalCache Enabled/ Disabled)

Does seem like its removing key from cache when I remove from LocalKeySet (which is returned by cachedKeySet())

and the cache in RedissonLocalCachedMap is fetched from this LocalCacheView instance only

Also wrote a test to check if removing key from this keyset does any change in time taken to fetch key after that.
RLocalCachedMap<String, User> cachedMap = redissonClient.getLocalCachedMap("myRLCMap", LocalCachedMapOptions.defaults());
        cachedMap.put("1", new User("1"));
        cachedMap.put("2", new User("2"));

        getRuntime("RLocalCachedMap GET 10k times", () -> {
            for (int i=0; i<10000; i++) {
                cachedMap.get("1");
                cachedMap.get("2");
            }
        });

        getRuntime("RLocalCachedMap Removing from Local KeySet 10k times", () -> {
            for (int i=0; i<10000; i++) {
                cachedMap.cachedKeySet().remove("1");
                cachedMap.cachedKeySet().remove("2");
            }
        });

        getRuntime("RLocalCachedMap GET 10k times while Removing from Local KeySet", () -> {
            for (int i=0; i<10000; i++) {
                cachedMap.cachedKeySet().remove("1");
                cachedMap.cachedKeySet().remove("2");
                cachedMap.get("1");
                cachedMap.get("2");
            }
        });

These are the results
RLocalCachedMap GET 10k times took: 30 ms
RLocalCachedMap Removing from Local KeySet 10k times took: 21 ms
RLocalCachedMap GET 10k times while Removing from Local KeySet took: 1425 ms

These results do suggest it is refetching from Redis?

Yes, i think it's fetched from redis, you can do monitor command in redis-cli to verify it's calling the redis for get operation.

Verified by monitoring Redis, this works! Thanks


text:
fix posts not showing up in network if author is not in connections

From @zzottel on March 13, 2015 23:24
Copied from original issue: friendica/red/pull/929

From @zzottel on March 13, 2015 23:53
Ok. I'm a bit baffled, too, because I could swear that I read Schneier's posts in my network at least some time this year, so this must have worked then. But I couldn't find anything in network.php's history up to last November that could have introduced the problem.

repo: redmatrix/redmatrix


text:
@ is output in map files

RGBLINK gets to see @ somehow... this, in itself, is a bug.

I'm not sure about that, RGBLINK does have some special handling for @: https://github.com/rednex/rgbds/blob/cb4fbdfcd534e43a5f8504b405acd7b8b29f5001/src/link/patch.c#L355

I meant that the symbol is defined, not that it's used in expressions. It's due to that very handling that no RGBASM object files should contain a definition of @.

This was fixed by #557, probably bt 5a65188ca94f2ebaa6ffabac4e7d04cb166de4d6

authors: ISSOtm NieDzejkob

repo: rednex/rgbds


text:
Choosing actions for reducer with regexp

Normally you write something like:
[SOME_ACTION_TYPE]: someActionTypeHandler,

So it picks a specific action type and handles it with specific reducer.
I'd like to be able to "catch" action types with regexp. For example, I want to handle every action type that ends with _DONE with a specific successReducer.
Don't see a way to do that with the current API. Should we implement something to enable such usecase?

Have you tried combineReducers? Less permissive than a refex, but more intentional.

Yes, but I'm looking for a more generic solution..
27.9.2017 23.59 "Victor Alvarez" notifications@github.com kirjoitti:

Have you tried combineReducers? Less permissive than a refex, but more
intentional.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
https://github.com/reduxactions/redux-actions/issues/246#issuecomment-332653528,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABilapHmBqxkCLhojvJQI6lyIPfreZTIks5smrc-gaJpZM4PmYuB
.

This is an important feature, I need it to create generic handlers that manages all actions with type ending in some name

@mslipper this should be done in the middleware in my opinion.

couldn't it be done in the handleAction, if the key of the map is a regex?
handleActions({
/^test/: (state, action) { ... }
})
this is a valid object, and it just means doing the check for regex type and executing the test, would be very simple, no?

haha... and 2 years later i come back wanting to do the same thing.. still no replies!? Is regex a thing yet?

I will close this issue, @mslipper answer seems like a valid solution.

authors: Jeewes alexander-heimbuch hendrul ivadenis tonypee yangmillstheory

repo: redux-utilities/redux-actions


text:
shorten-links processes way more links than required

Description
As the selector suggests, this feature is being applied to all the links on every page:
https://github.com/refined-github/refined-github/blob/7dbc106e7884fd82e771bcfc253fd7c259c19b97/source/features/shorten-links.tsx#L9
We should look into the feature’s git history to see where this feature is expected to work exactly (e.g. only on markdown, likely) and make the selector more specific, perhaps even avoiding known-misses like these 2 links:
Natively shortened
#5888
Natively extended

#5888

How to replicate the issue

Visit https://github.com/refined-github/refined-github/issues
I don't think any links would ever need to be shortened on this page, but the feature is run on 258 links

Extension version
any
Browser(s) used
any

This is because we have a filter inside the callback:
https://github.com/refined-github/refined-github/blob/444a6aa290ba81b20872e93b4d9d89c594b0b21d/source/github-helpers/dom-formatters.ts#L20-L23
I'm not sure if we can safely merge this given the link history of this solution:

https://github.com/refined-github/refined-github/pull/4759

I think we can still inline that selector before a[href], without altering the above logic. Like:
- observe(`a[href]:not(.${linkifiedURLClass})`)
+ observe(`:is(${codeElementsSelector}, .comment-body) a[href]:not(.${linkifiedURLClass})`)

This would limit the amount of times the callback is called.

repo: refined-github/refined-github


text:
Detect page changes in React-based views

Part of https://github.com/refined-github/refined-github/issues/6554

This properly detects page changes (even though I might have seen a CPU hang). Adding more info to the original issue.
Closing this PR


text:
Gradle 5.3.1

Gradle 5.3.1 is available.
This is sent by @gradleupdate. See https://gradleupdate.appspot.com/reflectoring/coderadar/status for more.

Closing, because #257 is available.

authors: gradleupdate maximAtanasov

repo: reflectoring/coderadar


text:
Can't have other property 'hasListener' when using Reflux.listenTo!

I get this exception when I use both Reflux.ListenerMixin and  Reflux.listenTo(store, "onChange") mixins :
    React.createClass({
    mixins: [Reflux.ListenerMixin, Reflux.listenTo(myStore, "onChange")],
    })

Please advise.
Thanks
Alexander

@jvmlet: What is the exception?

The exception is "Can't have other property 'hasListener' when using Reflux.listenTo!"

Please don't use Reflux.ListenerMixin together with Reflux.listenTo.

authors: jvmlet spoike

repo: reflux/refluxjs


text:
[Feature Request]: Error generating from LLM: This model's maximum context length is 8192 tokens. However, your messages resulted in  10254 tokens. Please reduce the length of the messages., retrying each prompt individually

Is your feature request related to a problem? Please describe.
So I broke my labels into 1024 tokens, but I'm still getting this error:
# dry-run -- this tells us how much this will cost and shows an example prompt
agent.plan('ml-test.csv')

# now, do the actual labeling
labels, df, metrics_list = agent.run('ml-test.csv', max_items=100)

Error generating from LLM: This model's maximum context length is 8192 tokens. However, your messages resulted in
10254 tokens. Please reduce the length of the messages., retrying each prompt individually
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 2.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 1.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 2.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 4.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..
WARNING:langchain.chat_models.openai:Retrying langchain.chat_models.openai.ChatOpenAI.completion_with_retry.<locals>._completion_with_retry in 8.0 seconds as it raised RateLimitError: Rate limit reached for default-gpt-4 in organization org-Qdih0ksDoVUSGpeSD2DK55zk on tokens per min. Limit: 40000 / min. Please try again in 1ms. Contact us through our help center at help.openai.com if you continue to have issues..

Describe the solution you'd like

agent.plan should give more information about if you are going to exceed the token limit. Possibly it could even suggest a max_token length to target, given your prompt and the desired responses.
The warning message should be more clear about what is actually happening to my queries.

Wanted to check that few shot is not set to a higher number - it looks like the prompt ends up being bigger than 8192 tokens. Is it possible for you to share the config?

authors: rajasbansal turian

repo: refuel-ai/autolabel


text:
Cambiar nombre de Medio Ambiente

Cambiar nombre de Medio Ambiente a Medio Ambiente y Ciudad

Done ✅

authors: ponentesincausa regenhans

repo: regenhans/informebajolupa


text:
Integrate Glint Language Server For Migrating Ember Applications

Glint is a superset of the TS language server that brings type checking to Ember/Glimmer templates. It does so by transforming HBS files to TS code, typechecking that and then mapping the ranges of those errors back into ranges in source code.
To fully type check properly migrate Ember applications we need to be able to use this language server to do the typechecking and codefixes for Ember applications.
The work that needs to happen here is:

[x] Land https://github.com/typed-ember/glint/pull/499
[ ] #463
[ ] #718
[ ] Refactor and adapt all the places where are typechecking or modifying code to go through an abstraction that adapts calls to the Glint and TS language server. It may be necessary to use Glint's transformmanager to properly modify code.

Bullet point 2 and bullet point 3 are overlapping with #463, so what's left of this ticket is bullet point 4.

I've update the description and break down task 2 and 3 into different tickets (assigned to myself)

authors: brendaHuang chadhietala haochuan

repo: rehearsal-js/rehearsal-js


text:
🛑 BINUSMAYA (Academic Services) is down

In c180e8f, BINUSMAYA (Academic Services) (https://binusmaya.binus.ac.id/LoginAD.php) was down:

HTTP code: 0
Response time: 0 ms

Resolved: BINUSMAYA (Academic Services) is back up in 33ce7a4.


text:
🛑 SLC Remote Lab (rlab.binus.ac.id) is down

In 119fe06, SLC Remote Lab (rlab.binus.ac.id) (https://rlab.apps.binus.ac.id/) was down:

HTTP code: 502
Response time: 995 ms

Resolved: SLC Remote Lab (rlab.binus.ac.id) is back up in b7d387d.


text:
🛑 BISANARA is down

In 3c0047a, BISANARA (https://bisanara.com) was down:

HTTP code: 0
Response time: 0 ms

Resolved: BISANARA is back up in aacaef8.


text:
🛑 GreatNusa.com is down

In 5a51174, GreatNusa.com (https://greatnusa.com) was down:

HTTP code: 403
Response time: 95 ms

Resolved: GreatNusa.com is back up in 5f61e1c.


text:
Export: Archived Records, Reports and Surveys

There is an archived flag for reports and surveys, but not yet for records in CastorStudy.

[ ]  Add archived flag for records
[ ]  Add function to not export archived data in csv, pandas and feather

Fixed in upcoming v0.1.0


text:
Support loading of osm pbf files

PbfParser is already in place, but it is not used inside GeoStore

Implemented in 69a5b33b54206bcc262579d888fc1b288ff6934a

repo: reinterpretcat/utymap


text:
Error rate 0% in report when no error rate is retrieved

Describe the bug
When the error rate cannot be retrieved from a provider, we fallback to 0% error rate and show it as Ok/valid in the output report
To Reproduce
$ ./bin/reliably slo report -v
DEBU[0000] Using config file: /Users/dmartin/.config/reliably/config.yaml
DEBU[0000] Loaded settings: map[auths:map[127.0.0.1:8000:map[token:***** username:dmartin35] reliably.com:map[token:***** username:dmartin35]]]
DEBU[0000] Loading manifest at reliably.yaml
WARN[0000] an error occured while getting a provider for resource: gcp
DEBU[0000] aws.AwsResource{arn:arn.ARN{Partition:"912823331559", Service:"apigateway", Region:"eu-west-3", AccountID:"", Resource:"/apis/8vdt1fhj3f"}}
DEBU[0000] Retrieve latency metrics From 2021-04-01 09:19:42.845416 +0200 CEST m=-86399.986385246 To 2021-04-02 09:19:42.845416 +0200 CEST m=+0.013614754
WARN[0000] an error occured while getting latency data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No latency value retrieved from cloud watch
DEBU[0000] aws.AwsResource{arn:arn.ARN{Partition:"912823331559", Service:"apigateway", Region:"eu-west-3", AccountID:"", Resource:"/apis/8vdt1fhj3f"}}
DEBU[0000] Retrieve error rate metrics From 2021-04-01 09:19:42.845416 +0200 CEST m=-86399.986385246 To 2021-04-02 09:19:42.845416 +0200 CEST m=+0.013614754
WARN[0000] an error occured while getting error percentage data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No error rate percent value retrieved from cloud watch

-----------
SLO report: (24h0m0s)
-----------
                   Actual  Target  Delta
  ✅ Error Budget  0.00    1.00    1.00%  You are under your error budget by 1.00 percent. You could tighten your budget, or could decrease
                                          the quality of the experience your application provides (e.g by reducing the amount of resources
                                          given to your application).

Expected behavior
Not showing the error rate line in the report when we could not compute/retrieve the value
or show unknown value:  ? , ---, N/A
Additional context
Add any other context about the problem here.

$ ./bin/reliably slo report -f simple
ERRO[0000] an error occured while getting latency data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No latency value retrieved from cloud watch
ERRO[0000] an error occured while getting error percentage data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No error rate percent value retrieved from cloud watch
SLO report: (last 1h0m0s)
✓ Error Rate: 0.00%. You are under your error budget by 1.00 percent. You could tighten your budget, or could decrease the quality of the experience your application provides (e.g by reducing the amount of resources given to your application).
✓ Latency: 0ms. The average latency threshold has not been exceeded.

@mick-roper do you have an idea on this one ? do you feel that's normal behavior ? or we shall handle nil / zero values, to know whether we were able to compute the value ?
Could we have some kind of output ?  would that make sense ?
-----------
SLO report: (last 1h0m0s)
-----------
                 Actual  Target  Delta
  ? Error Rate    ---    1.00    ---

  ? Latency       n/a    500ms   n/a

Btw, to reproduce, you ask for a period of one hour , on which no metrics are available

I think @dmartin35 idea to show --- to indicate no data was found should be ok. Users can potentially use the debug/verbose flag to see the errors, if any.

After looking at this for awhile I think we may need to settle for returning the error whenever a value can't be retrieved.
That is, rather than returning anything at all, if there's an error, we fail the whole process.
Reasoning:
Presently, ServiceLevelIndicators are calculated based on averaging all the values retrieved from the APIs per resources. If one of the values can't be retrieved or has an error, and we still collect and average the others, then the average would not be correct.
By returning the error, we force the user to insure that everything is working instead of giving partial success.
So the output of the above would become:
$ ./bin/reliably slo report -f simple
ERRO[0000] an error occured while getting latency data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No latency value retrieved from cloud watch
ERRO[0000] an error occured while getting error percentage data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No error rate percent value retrieved from cloud watch

Or the below, since we'd return on the 1st error we get
$ ./bin/reliably slo report -f simple
ERRO[0000] an error occured while getting latency data for resource: aws-arn:912823331559:apigateway:eu-west-3::/apis/8vdt1fhj3f => No latency value retrieved from cloud watch

Any thoughts @dmartin35 ?

I'm not totally sure about exiting the cli on first error occurred,
In the case you have multiple SLOs, you'll see nothing because one SLI of another SLO cannot be retrieved, is that not too hard ?
Regarding the error message, @Lawouach would like we avoid using logger for "conversing" with the user.
there is a related issue https://github.com/reliablyhq/cli/issues/154 already logged
In case we have one single value that can not be fetched for a SLI for a SLO, we could make its entire value "not available" (--- for example). That would still allow to see the other SLOs ?
but you're right this is not clear to me either which way we'd go

Seems to me a good idea to have "---" for the entire service if some data is missing, but still allow other SLOs to run. If failing on first is useful for users, a flag for failfast could be added.

Thanks @Xaah @dmartin35 ,
In order to make it so that we are able to print a blank line on errored metrics, I'll need to change how the internal report structure. I'll put something together in the PR for today..

authors: daidokoro dmartin35 xaah

repo: reliablyhq/cli


text:
C:\Python310\python.exe: No module named reloadium.flask_test

Describe the bug
Trying to run flask hello world app with reloadium gives error.
To Reproduce
Steps to reproduce the behavior:

pip install reloadium --user
python -m reloadium run .\flask_test.py

Expected behavior
Ideally it should start tracking files and reload app based on changes.
Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

OS: [Windows]
Reloadium package version: [0.8.7]
Editor: [Vscode]
Run mode: [Run/Debug]

That seems like a bug.
Could you try running it with ( example from https://flask.palletsprojects.com/en/2.1.x/quickstart/ ):
set FLASK_APP=flask_test
reloadium run -m flask run

or
set FLASK_APP=flask_test
python -m reloadium run -m flask run

I did but now it shows no module named wsgi and throws an import error

That's very strange. What flask version are you using?

flask.version
'2.0.1'

I don't think this is Reloadium bug (although the error message might make it look like it, will be fixed).
Does the app run without reloadium?
Can you just simply run python3 -m pip install wsgi and check again?

I did try that first unfortunately
utpal@utpal-ASUS-Gaming-FX570UD:~/pyStocks$ python3 -m pip install wsgi
ERROR: Could not find a version that satisfies the requirement wsgi (from versions: none)
ERROR: No matching distribution found for wsgi

And what about running without reloadium? Does it throw the error?

Without reloadium flask runs fine. I can test individual end points.

Ok I'll deep deeper than.
Do you happen to have a file wsgi.py in your project which you import somewhere?

Ok I know what is going on.
The first issue (from the original post) is reloadium issue and will be fixed.
The second is not really caused by reloadium (but it catches the error before flask which prevents it from printing a nice error - this will be fixed as well).
The problem is that your FLASK_APP env variable is not set.
You have to simply run export FLASK_APP=server instead of set FLASK_APP=server before running your app

Thanks a lot I was using set insted of export on ubuntu 🤣

will close this

repo: reloadware/reloadium


text:
Remarkable fail to lauch on openSUSE

Remarkable fail to lauch on openSUSE Leap 42.1
remarkable
*Spellchecking not enabled.
*To enable spellchecking install pygtkspellcheck
*https://pypi.python.org/pypi/pygtkspellcheck/
/usr/lib/python3/dist-packages/remarkable_lib/Builder.py:86: Warning: The property GtkWidget:margin-left is deprecated and shouldn't be used anymore. It will be removed in a future version.
  Gtk.Builder.add_from_file(self, filename)
/usr/lib/python3/dist-packages/remarkable_lib/Builder.py:86: Warning: The property GtkWidget:margin-right is deprecated and shouldn't be used anymore. It will be removed in a future version.
  Gtk.Builder.add_from_file(self, filename)

(remarkable:13918): Gtk-WARNING **: No object called:
openjdk version "1.8.0_72"
OpenJDK Runtime Environment (build 1.8.0_72-b15)
OpenJDK 64-Bit Server VM (build 25.72-b15, mixed mode)
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py", line 1329, in update_live_preview
    html_middle = markdown.markdown(text, self.default_extensions)
AttributeError: 'module' object has no attribute 'markdown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py", line 1332, in update_live_preview
    html_middle = markdown.markdown(text, extensions =self.safe_extensions)
AttributeError: 'module' object has no attribute 'markdown'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/bin/X11/remarkable", line 66, in <module>
    remarkable.main()
  File "/usr/lib/python3/dist-packages/remarkable/__init__.py", line 48, in main
    window = RemarkableWindow.RemarkableWindow()
  File "/usr/lib/python3/dist-packages/remarkable_lib/Window.py", line 54, in __new__
    new_object.finish_initializing(builder)
  File "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py", line 143, in finish_initializing
    self.update_live_preview(self)
  File "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py", line 1334, in update_live_preview
    html_middle = markdown.markdown(text)
AttributeError: 'module' object has no attribute 'markdown'

I got this problem in opensuse leap42.1,too.  I had already installed python3-markdown lib, but still didn't work

V1.75 has since been released, please check if the error still exists.
The repository is now located here.

version 1.75 still doesn't work in opensuse 42.1 !!!! I have download github repository and .rpm ,both of them work failed.
Error code:
Traceback (most recent call last):
File "/usr/bin/remarkable", line 65, in
import remarkable
File "/usr/lib/python3/dist-packages/remarkable/init.py", line 30, in
from remarkable import RemarkableWindow
File "/usr/lib/python3/dist-packages/remarkable/RemarkableWindow.py", line 26, in
gi.require_version("WebKit", '3.0')
File "/usr/lib64/python3.4/site-packages/gi/init.py", line 100, in require_version
raise ValueError('Namespace %s not available' % namespace)
ValueError: Namespace WebKit not available

You have to install libwebkitgtk3-devel too, than it works fine. So all you have to do is install Remarkable's rpm and theses libraries:
sudo zypper in libwebkitgtk3-devel python3-Markdown

I know this issue is rather old, but I was able to fix this by editing the RPM and adding the required dependencies, here's a quick rundown.
sudo zypper install rpmrebuild
rpmrebuild -e -p remarkable-1.87-1.rpm

change the line
Requires:	python3-markdown to
Requires:	python3-Markdown
Add the following line
Requires: libwebkitgtk3-devel
Write the file
Install wkhtmltopdf for your version of openSUSE from here: https://software.opensuse.org/package/wkhtmltopdf
Install the newly built rpm
sudo zypper in ~/rpmbuild/RPMS/noarch/remarkable-1.87-1.noarch.rpm

Lasted Tumbleweed snapshot doesn't contain libwebkitgtk3-devel, the one-click install from https://software.opensuse.org/package/libwebkitgtk3-devel solves it for me (there are many dependencies). Hopefully, they return the package back someday.

Doesn't work for Fedora 27.
ValueError: Namespace WebKit not available on Fedora 27 after installing using DNF. There is no available GTK3 version of WebKit libraries. Moving on to another notetaking application, I suppose.

doesn't work on F28
get "ValueError: Namespace WebKit not available " error.

the same problem arise in Leap 15.2

repo: remarkableapp/Remarkable-Linux


text:
feat: Add dynamic sidebar permissions customisation

This PR introduces sidebar customisation via permissions.
It is now possible to provide permission callback to "SIDEBAR"."default_permission" in UNFOLD settings to apply permissions to all sidebar items. You can override visibility of specific items to users by filling "permission" callback for each item.
If not item is visible for user, its group title also won't be shown. If "default_permission" is not specified, it will act as lambda request: True (anyone can see everything).

I added new logic for tab customization by request. It intuitively works the same as the sidebar permission logic.

repo: remastr/django-unfold


text:
GitHub deployments support.

WIP
This adds back in support for GitHub deployments, with the option of using tugboat as a deployment logs and status backend. If you're not using tugboat, but still using GitHub deployments then this will still work well for you. In the future, we can provide other deployer implementations that shuttle logs and status updates elsewhere.
Like the current provider within tugboat, it (by default) assumes that you have a matching docker repo with an image tagged with the git commit sha, but this is easy to change with the EMPIRE_GITHUB_DEPLOYMENTS_IMAGE_TEMPLATE environment variable. e.g.:
quay.io/{{ .Repository.FullName }}:{{ .Deployment.Ref }}

This also has some unique advantages over what we're doing right now:

It'll show who deployed in emp releases (TODO just need to add a column to releases)
Instead of pointing webhooks at some tugboat instance, you just point it at Empire now. Eventually, it could be nice to have a CLI command to setup the webhook for you.
It formats the json message stream so we get pretty output:

Tests are going to fail because I'm leaving out godeps to make it easier to review.
TODO

[x] Docs
[ ] Add user column to releases. (I'll save this for a followup PR).
[x] Use httpx.Handler in server/github.
[x] Make webhook perform deployment in a goroutine.
[ ] Commit godeps

This looks great :+1:
It would be nice to expose deployment logs and statuses to webhooks or services, similar to github webhooks and services. Tugboat could become a "service" in that scenario.

@bmarini totally. Having a webhook system would be really nice for extending some things.

authors: bmarini ejholmes


text:
Still seem to be a lot of errors in swift 3.0 branch

I'm trying out the 3.0 swift branch, however there seem to be a lot of errors still

Did you figure out a way to make it work with swift 3?

coming coming 🚀

authors: Fredehagelund92 remirobert sheharyar-rr

repo: remirobert/CameraEngine


text:
Dotzu + Alamofire

Hello,
I'm using Alamofire to handler my requests, and in your tutorial  you mentions it:
**/Your custom configuration
let configuration = URLSessionConfiguration.default
///Add the network logger on the configuration
Dotzu.sharedManager.addLogger(session: configuration)
//Use it:
//For Alamofire
let sessionManager = Alamofire.SessionManager(configuration: configuration)
//For URLSession
let session = URLSession(configuration: configuration)**
But I didn't use session in my requests, I make it directly ex:
Alamofire.request(url, method: .put, parameters..............
And it not log request on Doutzu, I think that it is because of session, How can I set a session in Alamofire manager??
Thx

you should create a session manager and use session manager instead of alamofire directly, dotzu need to observer the session configuration that you set.

authors: MaxCavalheiro mohamadrezakoohkan

repo: remirobert/Dotzu


text:
RFC: Pending export

Route Module Pending Component Export
There are two primary approaches to page transitions (ignoring suspense's ditched attempt at a third)

Indefinitely wait on the old screen
Transition immediately to spinners/skeleton

Right now Remix has picked (1), but with a new export to a route module, we could support both.
Today, if you have this, Remix will wait for all data to load before displaying the page
export function loader({ params }) {
  return User.find(params.userId);
}

export default function UserProfile() {
  let user = useRouteData();
  return <UserProfile user={user} />;
}

Like ErrorBoundary, we could add a Pending export:
export function loader({ params }) {
  return User.find(params.userId);
}

export function Pending() {
  return <UserProfileSkeleton />;
}

export default function UserProfile() {
  let user = useRouteData();
  return <UserProfile user={user} />;
}

If a route module exports a Pending component, Remix could switch to mode (2) and immediately display this screen when the location changes, dispalying <Pending/> until the route data all lands.
What about nested routes?
Remix will wait for any routes that don't export a Pending before displaying any other routes' Pending export. Some scenarios:

All routes have Pending: can transition immediately.
Parent without Pending, child route with Pending: wait for Parent, then transition immediately for Child.
A-Pending -> B-No -> C-Pending: Wait for B, transition to Pending

In summary, wait for all routes w/o pending, then transition.
So what?
On web and native, both types of transitions are common, and both have their tradeoffs depending on the data being fetched or the type of app you're building. In apps with very "app like" layouts with lots of persistent UI between location changes (rather than typical "pages" on the web with very little persistent UI), immediate transitions to skeleton UI is feels much better. For example, in Discord, it would feel weird to click on a channel and not go immediately to a shimmer/skeleton page. Conversely, we all know how terrible many webpages feel when clicking a link results in 12 spinners bouncing around before the page is built.
There's room for both transitions.
What's really interesting with Remix is that the Pending components in layouts can still render an outlet. This means that if a parent route's data is not as important as a child's you don't have to block the transition on it.
For example, load up a youtube video on a slower connection and you'll notice the primary content loads first, then the layout shows up around it.
Consider a typical master/detail view with these routes:
routes/
  - users.tsx
  - users/
    - index.tsx
    - $user.tsx

And let's say the UI has a sidebar of the users on the left, and the profile on the right:
  <Users>           <$User>
|----------------------------------|
|  bob     |       Bob Thornton    |
|  sally   |                       |
|  curtis  |                       |
...

The most important data at /users/bob-thornton is Bob's profile, not the user list.
So to get the users's profile displaying as fast as possible it could look like this:
// routes/users.tsx
export function loader() {
  return Users.findAll();
}

export function Pending() {
  return (
    <>
      <UsersSidebarSkeleton/>
      <Outlet/> {/* <-- Can still render an outlet! */}
    </>
  )
}

export default function UsersLayout() {
  let users = useRouteData()
  return (
    <>
      <UsersSidebar users={users}>
      <Outlet/>
    </>
  )
}

// routes/users/$userId.tsx
export function loader({ params }) {
  return Users.find(params.userId);
}

// no pending export we want to wait for this
export default function User() {
  let user = useRouteData()
  return (
    <UsersProfile user={user}>
  )
}

Now if you're looking at /recent-activity and click on a user's name, navigating to /users/sally-mae Remix will:

Keep the recent activity screen up
Start loading Users.findAll() and Users.find("sally-mae") in parallel for both users.tsx and users/$userId.tsx
As soon as users/$userId.tsx is complete, Remix will transition to the page
If users.tsx has not finished loading (probably more expensive anyway), the sidebar will just keep shimmering until it's loaded, but Sally's profile will be up!
Instead if users.tsx finished before users/$userId.tsx, then you're transitioned to a fully formed page.

Implementation

Transition hook: just like hasLoader and hasAction, we can easily know which loaders to wait on in the transition hook with a hasPending.

Transition hook: while we still kick off the fetches for the routes with pending ui and loaders, we don't await them. When they land, we just setState into routeData.

Client side redirects will be a little tricky, to get consistent behavior across document requests, no pending UI, and pending UI, we'd need to wait for all loaders to land (even the pending ones) before deciding to redirect. This means a child route without pending UI could render, and then a parent route with pending ui could redirect after. Also, a child route with pending UI that redirects, should stay in the pending state until all routes data has landed and then decide where to redirect.

<RemixRoute>: With a mix of hasLoader and hasPending, when it comes time to render the route, we can put a placeholder in the routeData state, or add a new piece of state to track which routes we're still waiting on, to decide to render the pending UI or not.

Server rendering: if a route has pending UI, do we skip the loader on the server render and go straight to pending? Ignore pending and always render the full page on the server? Add a way to let apps decide? I think we just render the whole thing. This would bring consistent results across document/fetch requests and then we could add a way to skip it later if we decide it's worth it.

Not sure if it's a bad idea, will just throw it here:
Is it possible to have the loader to be similar to getInitialProps of next? Or maybe have an option that after the initial load, the succeeding call would be client-side.
export let loader = {} => {
 // logic
}
// something like this:
loader.clientSideOnSucceedingCalls = true

@norman-ags check https://github.com/remix-run/remix/issues/179

authors: norman-ags ryanflorence sergiodxa

repo: remix-run/remix